0% found this document useful (0 votes)
43 views1 page

DBMS Cheatsheet

dbms

Uploaded by

mayagrace8526
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views1 page

DBMS Cheatsheet

dbms

Uploaded by

mayagrace8526
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

DBMS Concepts

Entity Relation Model Armstrong’s Axioms X+ Algorithm of Bernstein


• Entity: Distinguishable from other 1. If 𝑌 ⊂ 𝑋 ⊂ 𝑈 then 𝑋 → 𝑌, reflexive Set N=0 and 𝑋(0) = 𝑋(𝑔𝑖𝑣𝑒𝑛)
objects 2. If 𝑋 → 𝑌 and 𝑍 ⊂ 𝑈 then 𝑋𝑍 → 𝑌𝑍, augmented 1. ∀𝐴 → 𝐵 in f such that 𝐴 ⊂ 𝑋 and 𝐵 ∉ 𝑋.then
• Entity Set: Group of Entities 3. If 𝑋 → 𝑌 and 𝑌 → 𝑍 then 𝑋 → 𝑍, transitive 𝑋 = 𝑋∪𝐵
• Record: Each Row of Dataset 2. Repeat step two until no 𝐴 → 𝐵 such exists
• Attributes: Column-ID
Inference Rules Elementary and Redundant FD
• One - One: 1. {𝑋 → 𝑌, 𝑋 → 𝑍} then 𝑋 → 𝑌𝑍, Union Rule 𝑋 → 𝑌 is Elementary if ∄(𝑋 ′ ⊂ 𝑋 𝑎𝑛𝑑 𝑋 ′ → 𝑌)
2. {𝑋 → 𝑌, 𝑊𝑌 → 𝑍} then 𝑋𝑊 → 𝑍 F is a Redundant FD if (𝐹 − 𝑓)+ = 𝐹 +
3. {𝑋 → 𝑌, 𝑍 ⊂ 𝑌} then 𝑋 → 𝑍 In such cases partial dependency exists
• Many - One: 4. {𝑋 → 𝑌𝑍} then 𝑋 → 𝑌, 𝑋 → 𝑍
Lossless Join Property
• One - Many: Keys If 𝑟 = 𝜋𝑅1 (𝑟) ⋈ 𝜋𝑅2 (𝑟)
• Super: A combination of fields by which a row is Lossless if 𝑅1 ∩ 𝑅2 → 𝑅1 − 𝑅2 𝑜𝑟 𝑅2 − 𝑅1 𝑒𝑥𝑖𝑠𝑡𝑠 𝑖𝑛 𝑓
uniquely identified. If u add any column to primary key
• Many -Many: it becomes a super key. 1st Normal Form(1NF)
A
• Primary key: Any key which can uniquely identify As per the rule of first normal form, an attribute (column)
rows of the current table of a table cannot hold multiple values. It should hold only
• Subset Rel: Is A
B is a
• Candidate key: The minimal super key. Individual
subset atomic values.
of A
B columns in a table which qualifies for uniqueness of all
rows Boyce Codd Normal Form(BCNF)
Models • Foreign Key: Field or collection of fields which A relation is in BCNF 𝑖𝑓 𝑋 → 𝑌 𝑒𝑥𝑖𝑠𝑡𝑠 & 𝑌 ∉ 𝑋
• Network: ER model restricted to uniquely identifies a row of another table. then X is a key(candidate or super)
Binary, Many-One Relationships,
To break a many many relation 3NF or Third Normal Form Prime Attribute
𝑋 → 𝐴 is in 3NF if 𝐴 ∉ 𝑋 and either X is a key of A attribute which is a member or a subset of the key
insert temp between them and
insert 2 many-one relations relation or 𝐴 is a prime attribute.
• Hierarchical: Kind of Decision Transformation removes Partial And Transitive 2nd Normal Form(2NF)
Tree Dependency • Table is in 1NF (First normal form)
• No non-prime attribute is dependent on the proper subset of
Basic Relational Algebra Operators any candidate key of table.
• Union: 𝑅 ∪ 𝑆 Set of Tuples either in R or S both. R,S must have same number of attributes Partial Dependency is Removed
• Set Difference: 𝑅 − 𝑆 Set of Tuples present in R but not in S. Same attributes
• Cartesian Product: 𝑅 × 𝑆, Let R,S have arity(no of attributes) k1,k2. Then RxS is set of tuples Additional Relational Algebra Operators
st
with arity k1+k2 with 1 k1 components form tuple of R and last k2 components tuples of S • Intersection: 𝑅 ∩ 𝑆 = 𝑅 − (𝑅 − 𝑆) Set of Tuples both in R
• Projection: 𝜋𝑖1,𝑖2,…,𝑖𝑁 (𝑅) Set of tuples with attributes 𝑖1 , 𝑖2 , … , 𝑖𝑁 with same content with that of or S both. R,S must have same number of attributes
R • Quotient: 𝑅 ÷ 𝑆 let arity of R is r and S is s and 𝑟 > 𝑠, set
• Selection: 𝜎𝐹 (𝑅) set of tuples satisfying criteria F {Select C1,C2 from T1 where C3>2} of tuples ‘t’ with arity 𝑟 − 𝑠 st ∀ tuples ‘U’ in S, the tuple
𝑡𝑢(concat) is in R
Core Diagram Terminologies • 𝜽 Join: 𝑅 ⋈ 𝑖𝜃𝑗 𝑆, Set of Tuples that is in the subset of
• Cardinality: No of Tuples 𝑅 × 𝑆 satisfying 𝑖𝜃𝑗
• Natural Join: 𝑅 ⋈ 𝑆, Subset of 𝑅 × 𝑆 in which only those
• Arity: No of Attributes
tuples with same values for same attributes in R,S are
• Tuples: Represents Rows represented in same column

Type of Joins
• Natural Join: (or Inner Join) when tuples with
same values for same attributes in R,S are
represented in the same column
• Left Join: Takes values of all tuples of left
join, wherever same values for same attributes
in R,S are represented in the same column, if
there doesn’t exists a value in R, it will print
NULL
• Right Join: here R and S is interchanged from
above

You might also like