Unit III Normalization
Unit III Normalization
Selection(ς) – sigma ς <condition> (Relation) ς salary > 10K AND Dno = 3 (Employee)
Projection(π) - pi π <attribute list> (Relation) π Ename, Salary, Sex (Employee)
Rename(ρ) - rho ρ rename(a1,a2) (Relation) ρ newC(Cid, Cname, Sex) (customer)
Union(U) - union ∏ NAME(STUDENT) ∪ ∏ NAME(EMPLOYEE)
Set Difference (-) ∏ NAME(STUDENT) - ∏ NAME(EMPLOYEE)
Set Intersection (∩) ∏ NAME(STUDENT) ∩ ∏ NAME(EMPLOYEE)
Cartesian Product (X) STUDENT X EMPLOYEE
Division % or / ENROL(STU_ID, CRSE_ID)/CRSE(CRSE_ID)
Joins ( inner join [theta, equi, natural] and outer join [left, right, full] )
Theta Join (θ) EMPLOYEE⋈θ EMPLOYEE.EXPERIENCE>=DEPARTMENT.MIN_EXPERIENCE DEPARTMENT
Equi Join (=) EMPLOYEE ⋈EMPLOYEE.E_NO = DEPARTMENT.E_NO DEPARTMENT
Natural Join (⋈) EMPLOYEE ⋈ DEPARTMENT
Left Outer Join ⟕ EMPLOYEE ⟕EMPLOYEE.E_NO = DEPARTMENT.E_NO DEPARTMENT
Right Outer Join ⟖ EMPLOYEE ⟖EMPLOYEE.E_NO = DEPARTMENT.E_NO DEPARTMENT
Full Outer Join ⟗ EMPLOYEE ⟗EMPLOYEE.E_NO = DEPARTMENT.E_NO DEPARTMENT
Remember that TRC can be quantified. Existential (or ∃) as well as Universal Quantifiers (or ∀).
Example
{ R| ∃T ∈ Writers(T.blog=’information’ AND R.name=T.name)}
The output would be − The query given above would yield a similar result as the very previous one.
Here b1, b2 refer to the attributes, and P refers to the formulae that the inner attributes have built.
Example
{< page, article, subject > | ∈ Chocolate ∧ subject = ‘information’}
The output would be − Yielding Page, Article, as well as Subject from the relation Chocolate,
where subject refers to the database.
DRC, just like TRC, can be written using universal and existential quantifiers. Also, DRC involves relational
operators.
Remember that the expression power of the TRC and the DRC is equivalent to the Relational Algebra.
Normalization in DBMS
Q. Why do we need Normalization in DBMS?
Consider a schema R(ABCDE) and FDs {AB → C, C → D, B → EA}. Find the superkey.
Solution:
Find closure set of (A, B, C, AB)
Closure of A = A + = {A}
Closure of B = B + = {B, E, A, C, D}
Closure of C = C + = {C, D}
Closure of AB = AB + = {A, B, C, D, E} So, AB and B are superkeys. But only B is the candidate key.