Académique Documents
Professionnel Documents
Culture Documents
UNIT -6
Database Design
Informal Design Guidelines for Relation Schemas; Functional Dependencies;
Normal Forms Based on Primary Keys; General Definitions of Second and
Third Normal Forms; Boyce-Codd Normal Form.
Fourth Normal Form; and Fifth Normal Form;
USN No
Sem
VTU-EDUSAT
Page 1
The main goal of the schema diagram is to minimize the storage space that the base
memory occupies.Grouping attributes information relations has asignificant effect on
storage space.
Eg;
Student name
USN No
Sem
Eg:
Dept Name
Dept No
If we integrate these two and is used as a single table i.e Student Table
USN No
Student name
Sem
Dept No
Dept Name
Here whenever if we insert the tuples there may be N stunents in one department,so
Dept No,Dept Name values are repeated N times which leads to data redundancy.
Another problem is updata anamolies ie if we insert new dept that has no students.
If we delet the last student of a dept,then whole information about that department will be
deleted
If we change the value of one of the attributes of aparticaular table the we must update
the tuples of all the students belonging to thet depy else Database will become
inconsistent.
Note: Design in such a way that no insertion ,deletion,modification anamolies will occur
3. Reducing Null values in Tuples.
Note: Relations should be designed such that their tuples will have as few NULL
values as possible
Attributes that are NULL frequently could be placed in separate relations (with the
primary key)
Reasons for nulls:
attribute not applicable or invalid
attribute value unknown (may exist)
VTU-EDUSAT
Page 2
Functional dependency
1. Functional dependencies (FDs) are used to specify formal measures of the
"goodness" of relational designs
2. FDs and keys are used to define normal forms for relations
3. FDs are constraints that are derived from the meaning and interrelationships of
the data attributes
4. X->Y : A set of attributes X functionally determines a set of attributes Y if the
value of X determines a unique value for Y
5. X -> Y holds if whenever two tuples have the same value for X, they must have
the same value for Y
6. For any two tuples t1 and t2 in any relation instance r(R): If t1[X]=t2[X], then
t1[Y]=t2[Y]
7. X -> Y in R specifies a constraint on all relation instances r(R)
8. Written as X -> Y; can be displayed graphically on a relation schema as in
Figures. ( denoted by the arrow: ).
9. FDs are derived from the real-world constraints on the attributes
10. social security number determines employee name
SSN -> ENAME
11.project number determines project name and location
PNUMBER -> {PNAME, PLOCATION}
11. employee ssn and project number determines the hours per week that the
employee works on the project
VTU-EDUSAT
Page 3
VTU-EDUSAT
Page 4
Each attribute in an entity must depend on the whole key, not just a part of it.
VTU-EDUSAT
Page 5
VTU-EDUSAT
Page 6
Example 1
CUSTOMER
CustomerID
Firstname
Surname
City
PostCode
12123
Harry
Enfield
London
SW7 2AP
12443
Leona
Lewis
London
WC2H 7JY
354
Sarah
Brightman
Coventry
CV4 7AL
VTU-EDUSAT
Page 7
Firstname
Surname
PostCode*
12123
Harry
Enfield
SW7 2AP
12443
Leona
Lewis
WC2H 7JY
354
Sarah
Brightman
CV4 7AL
POSTCODES
PostCode
City
SW7 2AP
London
WC2H 7JY
London
CV4 7AL
Coventry
Example 2.
VideoID
Title
Certificate
Description
12123
Saw IV
18
12443
Igor
PG
Parental Guidance
354
Bambi
Universal Classification
The Description of what the certificate means could be obtained frome the certifcate
attribute - it does not need to refer to the primary key VideoID. So split it out and use the
primary key / secondary key approach.
Example 3
CLIENT
ClientID
CinemaID*
CinemaAddress
12123
LON23
12443
COV2
354
MAN4
CINEMAS
CinemaID
CinemaAddress
LON23
VTU-EDUSAT
Page 8
MAN4
In this case the database is almost in 3NF - for some reason the Cinema Address is being
repeated in the Client table, even though it can be obtained from the Cinemas table. So
simply remove the column from the client table
Definition:
A multivalued dependency (MVD) X >> Y specified on relation
schema R, where X and Y are both subsets of R, specifies the
following constraint on any relation state r of R: If two tuples t1 and t2
exist in r such that t1[X] = t2[X], then two tuples t3 and t4 should also
VTU-EDUSAT
Page 9
Example
VTU-EDUSAT
Page 10
Constraints as Assertions
VTU-EDUSAT
Page 11
VTU-EDUSAT
Page 12