Creation of logical relational database.
Creation of logical relational database
EXAMPLES OF DATA BASE DESIGN
ORDER - VENDOR - ITEMS ORDERED EXAMPLE IN CASE STUDY
Information on dependencies given :
•Orders for item placed with many vendors
•A given order no is only to one vendor
•Many items supplied against a given order no
•A vendor has capacity to supply many items but only some items maybe ordered from him at a particular time
RELATIONS-UNNORMALIZED
EXAMPLES OF UNNORMALIZED RELATIONS
1. ORDERS(Order no,Order date)
2. ORDERS PLACED FOR(Order no,item code,qty ordered,delivery time allowed)
3. ORDERS PLACED WITH(order no,vendor code,item code)
4. VENDOR(Vendor code,vendor name,vendor address) 5.ITEM( item code,item name,price/unit)
6. SUPPLIES(vendor code,item code,order no,qty.supplied,date of supply)
NORMALIZATION:
Relation 1,4,5 are in 3NF and need no change
Relation 2 has a composite key,attributes of composite key not related. Non key attributes dependent on composite key,need no change.
Relation 3: order no and item code have multivalued dependency.Relation2
already has order no,item code as composite key.
Relation 3 is reduced to:
7. ORDER PLACED WITH(order no,vendor code)
NORMALIZATION OF SUPPLIES RELATION
Consider relation 6 :
6. SUPPLIES (vendor code, item code, order no, qty supplied, date of supply)
•It has a composite key with three attributes
•Attributes item code and order no have multi-valued dependency as many items can be supplied in one order
• And hence need normalization to 4NF
Normalized to
8. ACTUAL SUPPLIES (order no, item code, qty supplied, date of
supply)
9. VENDOR CAPABILITY (vendor code, item code )
The second relation may have items not yet ordered with a vendor but which could be supplied by vendor
The Normalized relations are : 1,2,4,5,7,8,9
STUDENT-TEACHER-COURSES EXAMPLE
Information on dependence
•A teacher may teach more than one course in a semester
•A teacher belongs to only one dept.
•A student may take many courses in a semester
•A course may have many sections taught by different teachers
E-R Diagram
RELATION-UNNORMALIZED
1 TEACHER (Teacher code,teacher name, address, rank, dept)
2 TEACHER_COURSES (Teacher code,Course no,no of students, section no )
3 COURSE (Course no , semester taught ,Course name, credits)
4 STUDENT (Student no, student name, dept, year )
5 STUDENT COURSES (Student no, Course no, semester no ) a)Relations 1,3,4 in 3NF
b) Relations 2 and 5 have multi-attribute key which has multi-valued dependency but do not need normalization
c)However information on which teacher teaches a given student a specified course cannot be found from relations 1 to 5
Therefore Add relation
6TEACHER_STUDENT (Teacher code, Student no, Course no)
THIS SET IS NORMALIZED
CONCLUSIONS
• We have seen how data relevant to applications are organized logically into set of relations
• The process of normalization depends on the semantics, i.e, meanings of data and an understanding of how various data elements are related
•It is thus a human intensive activity-it cannot be automated
• In most problems in practice one is satisfied with 3NF.Higher normal forms are theoretically important and in some cases becomes essential.
• There is a mathematical theory which underpins the idea of relations and normalization giving it a sound basis. We have not discussed it in this module.
• A full fledged course in Data Base will describe in detail the mathematical basis and methods of querying a database
Comments
Post a Comment