0% found this document useful (0 votes)
18 views

Unit III Normalization

Uploaded by

kishwaryarani
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)
18 views

Unit III Normalization

Uploaded by

kishwaryarani
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/ 4

UNIT III - NORMALIZATION

Relational Algebra is a procedural query language.


Relational algebra mainly provides a theoretical foundation for relational databases and SQL.
The main purpose of using Relational Algebra is to define operators that transform one or more
input relations into an output relation.
Relational Algebra and operators are represented using symbols.

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

A complete set of relational algebra operations:


{ σ, π, U, –, ×} is a complete set of relational algebra operations.
Relational Calculus
Relational Calculus, as compared to Relational Algebra, refers to a non-procedural type of query language.
It means that it would tell you what to do but would never explain how to do it.

The relational calculus exists in these two forms:


1. Tuple Relational Calculus (or TRC)
2. Domain Relational Calculus (or DRC)

Tuple Relational Calculus (or TRC)


These filter the variable ranges over the tuples

The notation is − {T | Condition}

It returns all the tuples T that satisfy the given condition.


Example
{ T.name | Writer(T) AND T.blog = ‘information’ }

The output would be –


It would return the tuples with the ‘name’ from the Writer that has written a blog on the ‘information’.

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.

Domain Relational Calculus (or DRC)


The filtering variable in DRC makes use of the attributes domain instead of the values of an entire tuple

The notation is − { b1, b2, b3, …, an | P (b1, b2, b3, … ,bn)}

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?

Database Normalization helps you design and structure your table


properly so that you have proper relationships between tables.
1. Data Integrity
2. Data consistency
3. Better relationship between tables
4. More scalable design for tables.
5. No large tables, small tables with a proper relationship.
6. Removing dependencies, like Partial Dependency, Transitive
Dependency, Join Dependency, etc.

Q. What are the different Normal Forms in DBMS?

1. First Normal Form also known as 1NF


2. Second Normal Form or 2NF
3. Third Normal Form or 3NF
4. Boyce-Codd Normal Form or BCNF or 3.5NF or strong 3NF
5. Fourth Normal Form or 4NF
6. Fifth Normal Form or 5NF or PJNF (Project-Join Normal Form)

1. It should only have single (atomic) valued attributes/columns.


1NF 2. Values stored in a column should be of the same domain.
3. All the columns in a table should have unique names.
1. It should be in the First Normal form.
2NF 2. And, it should not have Partial Dependency.
1. It satisfies the First Normal Form and the Second Normal form.
3NF 2. And, it doesn't have Transitive Dependency.
1. R must be in the 3rd Normal Form
BCNF 2. and, for each functional dependency ( X → Y ), X should be a Super Key.
1. It is in the Boyce-Codd Normal Form.
4NF 2. And, it doesn't have Multi-Valued Dependency.
1. It is the most advanced level of Database Normalization.
5NF 2. Using Fifth Normal Form you can fix Join dependency and reduce data redundancy.
Key
It is a minimum set of attributes used to differentiate/identify all
the tuples of the table.
Super-key is a superset of candidate key.
Every candidate key is a super-key but not vice versa.
In other words, candidate key is the minimal super-key.

 Functional dependencies F = {A → B,B → C, C → D} is given, find closure of A, B, C and D.


Solution:
Closure of A = A + = (A, B, C, D)
Closure of B = B + = (B, C, D)
Closure of C = C + = (C, D)
Closure of D = D + = (D)

 Consider a schema R(ABCDE) and FDs {AB → C, C → D, B → E}. Find superkey.


Solution:
Find closure set of (A, B, C, AB).
Closure of A = A + = {A}
Closure of B = B + = {B, E}
Closure of C = C + = {C, D}
Closure of AB = AB + = {A, B, C, D, E} So, AB is the superkey.

 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.

 Give the following relation instance:


xyz Which of the following functional dependencies are satisfied by the instance?
142 (a) XY → Z and Z → Y
153 (b) YZ → X and Y → Z
163 (c) YZ → X and X → Z
322 (d) XZ → Y and Y → X

Let R = (A, B, C, D, E, F) be a relation scheme with the following dependencies


C → F, E → A, EC → D, A → B. Which of the following is a key for R?
(a) CD (b) EC (c) AE (d) AC
Consider a relation scheme R = (A, B, C, D, E, H ) on which the following functional
dependencies hold: {A → B, BC → D, E → C, D → A}. What are the candidate keys of R?
(a) AE, BE (b) AE, BE, DE (c) AEH, BEH, BCH (d) AEH, BEH, DEH
 functional dependencies are given: AB → CD, AF → D, DE → F, C → G, F → E, G→ A
Which one of the following options is false?
(a) {CF}+ = {ACDEFG} (b) {BG}+ = {ABCDG}
(c) {AF}+ = {ACDEFG} (d) {AB}+ = {ABCDFG}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy