Relational Database Design
Relational Database Design
Instructor
Indra Chaudhary
[email protected]
DBMS: Syllabus
2
tuples
Informal Design Guidelines for Relational
Schemas
5
Insertion Anomaly refers to when one cannot insert a new tuple into a
relationship due to lack of data.
This kind of anomaly can seriously damage a database
Deletion Anomaly:
The delete anomaly refers to the situation where the deletion of data
results in the unintended loss of some other important data.
It could result in loss of vital data.
Update Anomaly:
The update anomaly is when an update of a single data value requires
multiple rows of data to be updated.
This can lead to inefficiency.
Informal Design Guidelines for Relational
Schemas
7
Most
Mostdatabases
databasesshould
shouldbe
be3NF
3NFininorder
ordertotoavoid
avoidthe
thedatabase
databaseanomalies.
anomalies.
Levels of Normalization
13
1NF
2NF
3NF
4NF
5NF
DKNF
Each
Eachhigher
higherlevel
levelisisaasubset
subsetofofthe
thelower
lowerlevel
level
Normal Forms: Levels / Types
14
1 NF
No multivalued attributes or repeating groups.
2 NF
1 NF plus no partial dependencies
3 NF
2 NF plus no transitive dependencies
4 NF
3 NF plus no multi-values dependencies
5 NF
4 NF plus no join dependencies
16
STUDENT
EMPLOYEE
BOOK
ISBN Title
Publisher is a non-key attribute, and
ISBN Publisher it determines Address, another non-
Publisher Address key attribute. Therefore, there is a
transitive dependency, which means
that the relation is NOT in 3 NF.
BOOK
BOOK
BOOK
Product_ID Description
Product_ID Description
ORDER
Product_ID Description
ORDER
Product_ID Description
PART
PART
STUDENT
STUDENT
STUDENT
STUDENT
Stud_ID Name
101 Lennon
125 Jonson
STUDENT_COURSE
Composite
Primary Key
STUDENT
STUDENT
Remove attributes that are dependent from the part but not the
whole of the primary key from the original relation. For each
partial dependency, create a new relation, with the
corresponding part of the primary key from the original as the
primary key.
STUDENT
CUSTOMER STUDENT_COURSE
Stud_ID Name Course_ID Units
101 Lennon MSI 250 3.00
101 Lennon MSI 415 3.00
Stud_ID Course_ID
125 Johnson MSI 331 3.00
101 MSI 250
101 MSI 415
125 MSI 331
STUDENT COURSE
Transitive
Dependency
EMPLOYEE
EMPLOYEE
DEPARTMENT
Dept_ID Dept_Name
1 Acct
2 Mktg
42
Thank You