Download presentation
Presentation is loading. Please wait.
Published byFay Ellis Modified over 8 years ago
1
1 From E-R Model to Relational Model
2
2 Entity type sid#name address house#street pcode Student
3
3 From E-R Model to Relational Model Entity type-----> Relational schema sid#name address house#street pcode Student sid# namehouse# street pcode 950001 Peter 10 Northfields 2522............... Student
4
4 From E-R Model to Relational Model Entity type-----> Relational schema sid# namehouse# street pcode 950001 Peter 10 Northfields 2522............... sid#name address house#street pcode Student
5
5 From E-R Model to Relational Model Entity type-----> Relational schema sid# namehouse# street pcode 950001 Peter 10 Northfields 2522............... sid#name address house#street pcode Student Primary key
6
6 From E-R Model to Relational Model Instances of entities Kate Peter Paul Mary Student
7
7 From E-R Model to Relational Model Instances of entities----->Rows in relational table Instances of entities----->Rows in relational table Kate Peter Paul Mary sid# namehouse# street pcode 9205 Kate 10 Train 2301 9307 Peter 123 Train 2301 9234 Paul 34 Ross 2056 9326 Mary 34 Ross 2056 Student
8
8 From E-R Model to Relational Model Multivalued attribute sid# name hobbies Student
9
9 From E-R Model to Relational Model Multivalued attribute---->Relational schema 9205 Kate 9307 Peter 9234 Paul 9326 Mary sid# name swimming painting pop music computers swimming gardening astronomy hobby sid# name hobbies Student
10
10 From E-R Model to Relational Model Multivalued attribute---->Relational schema 9205 Kate 9307 Peter 9234 Paul 9326 Mary sid# name 9205 swimming 9205 painting 9307 pop music 9234 computers 9234 swimming 9326 gardening 9326 astronomy sid# hobby sid# name hobbies Student
11
11 From E-R Model to Relational Model Multivalued attribute---->Relational schema sid# name hobbies Student 9205 Kate 9307 Peter 9234 Paul 9326 Mary sid# name 9205 swimming 9205 painting 9307 pop music 9234 computers 9234 swimming 9326 gardening 9326 astronomy sid# hobby
12
12 From E-R Model to Relational Model Multivalued attribute---->Relational schema sid# name hobbies Student 9205 Kate 9307 Peter 9234 Paul 9326 Mary sid# name 9205 swimming 9205 painting 9307 pop music 9234 computers 9234 swimming 9326 gardening 9326 astronomy sid# hobby
13
13 From E-R Model to Relational Model Multivalued attribute---->Relational schema 9205 Kate 9307 Peter 9234 Paul 9326 Mary sid# name 9205 swimming 9205 painting 9307 pop music 9234 computers 9234 swimming 9326 gardening 9326 astronomy sid# hobby sid# name hobbies Student Primary key
14
14 From E-R Model to Relational Model Multivalued attribute---->Relational schema 9205 Kate 9307 Peter 9234 Paul 9326 Mary sid# name 9205 swimming 9205 painting 9307 pop music 9234 computers 9234 swimming 9326 gardening 9326 astronomy sid# hobby sid# name hobbies Student Primary key Foreign key
15
15 From E-R Model to Relational Model Multivalued attribute---->Relational schema Do we really need two tables? Multivalued attribute---->Relational schema Do we really need two tables?
16
16 From E-R Model to Relational Model Multivalued attribute---->Relational schema Do we really need two tables? Multivalued attribute---->Relational schema Do we really need two tables? 9205 Kate swimming 9205 Kate painting 9307 Peter pop music 9234 Paul computers 9234 Paul swimming 9326 Mary gardening 9326 Mary astronomy sid# name hobby
17
17 From E-R Model to Relational Model Multivalued attribute---->Relational schema Do we really need two tables? Multivalued attribute---->Relational schema Do we really need two tables? 9205 Kate swimming 9205 Kate painting 9307 Peter pop music 9234 Paul computers 9234 Paul swimming 9326 Mary gardening 9326 Mary astronomy sid# name hobby Redundant !!!
18
18 From E-R Model to Relational Model Multivalued attribute---->Relational schema Do we really need two tables? Multivalued attribute---->Relational schema Do we really need two tables? 9205 Kate swimming 9205 Kate painting 9307 Peter pop music 9234 Paul computers 9234 Paul swimming 9326 Mary gardening 9326 Mary astronomy sid# name hobby YES ! We do !!! Redundant !!!
19
19 From E-R Model to Relational Model One-to-One Relationship Department Chairperson name building# manages title (0,1)(1,1)
20
20 From E-R Model to Relational Model One-to-One Relationship----->Relational schema One-to-One Relationship----->Relational schema Department Chairperson name building# manages title dname building# cname title ITACS 3 Joan Prof........... (0,1)(1,1)
21
21 From E-R Model to Relational Model One-to-One Relationship----->Relational schema One-to-One Relationship----->Relational schema Department Chairperson name building# manages title dname building# cname title ITACS 3 Joan Prof........... (0,1)(1,1) Primary key
22
22 From E-R Model to Relational Model One-to-One Relationship----->Relational schema One-to-One Relationship----->Relational schema Department Chairperson name building# manages title dname building# cname title ITACS 3 Joan Prof........... (0,1)(1,1) Primary key Candidate key
23
23 From E-R Model to Relational Model One-to-One Relationship----->Relational schema One-to-One Relationship----->Relational schema Department Chairperson name building# manages title dname building# cname title ITACS 3 Joan Prof........... (0,1)(1,1) Primary key Candidate key May be NULL
24
24 From E-R Model to Relational Model One-to-Many Relationship Employee Project works-on e#ename cdate budget title (1,1)(1,m)
25
25 From E-R Model to Relational Model One-to-Many Relationship---->Relational schemas One-to-Many Relationship---->Relational schemas Employee Project works-on e#ename cdate budget title (1,1)(1,m) 100 Peter 200 Paul 300 Mary e# ename SQL2001 100000 31/12/99 ObjectBin 20000 31/12/97 title budget cdate Employee Project
26
26 From E-R Model to Relational Model One-to-Many Relationship---->Relational schemas One-to-Many Relationship---->Relational schemas Employee Project works-on e#ename cdate budget title (1,1)(1,m) 100 Peter SQL2001 200 Paul SQL2001 300 Mary ObjectBin e# ename proj-title SQL2001 100000 31/12/99 ObjectBin 20000 31/12/97 title budget cdate Employee Project
27
27 From E-R Model to Relational Model One-to-Many Relationship---->Relational schemas One-to-Many Relationship---->Relational schemas Employee Project works-on e#ename cdate budget title (1,1)(1,m) 100 Peter SQL2001 200 Paul SQL2001 300 Mary ObjectBin e# ename proj-title SQL2001 100000 31/12/99 ObjectBin 20000 31/12/97 title budget cdate Employee Project
28
28 From E-R Model to Relational Model One-to-Many Relationship---->Relational schemas One-to-Many Relationship---->Relational schemas Employee Project works-on e#ename cdate budget title (1,1)(1,m) 100 Peter SQL2001 200 Paul SQL2001 300 Mary ObjectBin e# ename proj-title SQL2001 100000 31/12/99 ObjectBin 20000 31/12/97 title budget cdate Employee Project Primary key
29
29 From E-R Model to Relational Model One-to-Many Relationship---->Relational schemas One-to-Many Relationship---->Relational schemas Employee Project works-on e#ename cdate budget title (1,1)(1,m) 100 Peter SQL2001 200 Paul SQL2001 300 Mary ObjectBin e# ename proj-title SQL2001 100000 31/12/99 ObjectBin 20000 31/12/97 title budget cdate Employee Project Primary key Primary key
30
30 From E-R Model to Relational Model One-to-Many Relationship---->Relational schemas One-to-Many Relationship---->Relational schemas Employee Project works-on e#ename cdate budget title (1,1)(1,m) 100 Peter SQL2001 200 Paul SQL2001 300 Mary ObjectBin e# ename proj-title SQL2001 100000 31/12/99 ObjectBin 20000 31/12/97 title budget cdate Employee Project Primary key Primary key Foreign key
31
31 From E-R Model to Relational Model Many-to-Many relationship Supplier Parts supplies s#name p# (0,m)(0,n)
32
32 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw
33
33 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 100 10 100 20 200 20 300 10 Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw
34
34 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 100 10 100 20 200 20 300 10 Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw
35
35 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 100 10 100 20 200 20 300 10 Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw Primary key
36
36 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 100 10 100 20 200 20 300 10 Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw Primary key Primary key
37
37 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 100 10 100 20 200 20 300 10 Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw Primary key Primary key Primary key
38
38 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 100 10 100 20 200 20 300 10 Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw Primary key Primary key Primary key Foreign key
39
39 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 100 10 100 20 200 20 300 10 Supplier Parts supplies s#name p# (0,m)(0,n) Supplier Part s# name 100 John 200 Peter 300 Joan p# pname 10 bolt 20 nut 30 screw Primary key Primary key Primary key Foreign key Foreign key
40
40 From E-R Model to Relational Model Attributes describing relationship Supplier Parts supplies s#name p# (0,m)(0,n) quantity
41
41 From E-R Model to Relational Model Attributes describing relationship Supplier Parts supplies s#name p# (0,m)(0,n) SupplierSP Part s# name 100 John 200 Peter 300 Joan s# p# quantity 100 10 200 100 20 200 200 20 300 300 10 50 p# pname 10 bolt 20 nut 30 screw quantity
42
42 From E-R Model to Relational Model Weak entity Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner
43
43 From E-R Model to Relational Model Weak entity ---> relational schema airplane# type owner PL234 A303 LOT US124 B747 BTA WE222 B737 AF airplane# seat# position PL234 01 window PL234 02 aisle......... US124 01 window......... Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Airplane Seat
44
44 From E-R Model to Relational Model Weak entity ---> relational schema airplane# type owner PL234 A303 LOT US124 B747 BTA WE222 B737 AF airplane# seat# position PL234 01 window PL234 02 aisle......... US124 01 window......... Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Airplane Seat
45
45 From E-R Model to Relational Model Weak entity ---> relational schema airplane# type owner PL234 A303 LOT US124 B747 BTA WE222 B737 AF airplane# seat# position PL234 01 window PL234 02 aisle......... US124 01 window......... Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Primary key Airplane Seat
46
46 From E-R Model to Relational Model Weak entity ---> relational schema airplane# type owner PL234 A303 LOT US124 B747 BTA WE222 B737 AF airplane# seat# position PL234 01 window PL234 02 aisle......... US124 01 window......... Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Primary key Foreign key Airplane Seat
47
47 From E-R Model to Relational Model Weak entity ---> relational schema airplane# type owner PL234 A303 LOT US124 B747 BTA WE222 B737 AF airplane# seat# position PL234 01 window PL234 02 aisle......... US124 01 window......... Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Primary key Foreign key Primary key Airplane Seat
48
48 From E-R Model to Relational Model Generalization
49
49 From E-R Model to Relational Model Generalization ---> relational schema (1)
50
50 From E-R Model to Relational Model Undergraduate studentPostgraduate student s# name project group# supervisor Student Generalization ---> relational schema (1) Undergraduate studentPostgraduate student s# name project group# supervisor Student
51
51 From E-R Model to Relational Model Generalization ---> relational schema (1) Undergraduate studentPostgraduate student s# name project group# supervisor Student s#name pgroup#supervisortype 007James13NULLundergraduate 008JoanNULLPeterpostgraduate 009Mary14NULLundergraduate 010Michael15NULLundergraduate Student
52
52 From E-R Model to Relational Model Generalization ---> relational schema (1) s#name pgroup#supervisortype 007James13NULLundergraduate 008JoanNULLPeterpostgraduate 009Mary14NULLundergraduate 010Michael15NULLundergraduate Student Undergraduate studentPostgraduate student s# name project group# supervisor Student
53
53 From E-R Model to Relational Model Generalization ---> relational schema (1) s#name pgroup#supervisortype 007James13NULLundergraduate 008JoanNULLPeterpostgraduate 009Mary14NULLundergraduate 010Michael15NULLundergraduate Student Undergraduate studentPostgraduate student s# name project group# supervisor Student Primary key
54
54 From E-R Model to Relational Model Generalization ---> relational schemas (2) Undergraduate studentPostgraduate student s# name project group# supervisor Student
55
55 From E-R Model to Relational Model Generalization ---> relational schemas (2) Undergraduate studentPostgraduate student s# name project group# supervisor Student UStudent s#name pgroup#s#namesupervisor 007James13 008JoanPeter 009Mary14 010Michael15 PStudent
56
56 From E-R Model to Relational Model Generalization ---> relational schemas (2) Undergraduate studentPostgraduate student s# name project group# supervisor Student UStudent s#name pgroup#s#namesupervisor 007James13 008JoanPeter 009Mary14 010Michael15 PStudent Primary key
57
57 From E-R Model to Relational Model Generalization ---> relational schemas (3) Undergraduate studentPostgraduate student s# name project group# supervisor Student
58
58 From E-R Model to Relational Model Generalization ---> relational schemas (3) Undergraduate studentPostgraduate student s# name project group# supervisor Student PStudent s#names# pgroup#s#supervisor 007James00713 008Peter 008Joan 009Mary00914 010Michael01015 UStudent
59
59 From E-R Model to Relational Model Generalization ---> relational schemas (3) Undergraduate studentPostgraduate student s# name project group# supervisor Student PStudent s#names# pgroup#s#supervisor 007James00713 008Peter 008Joan 009Mary00914 010Michael01015 UStudent Primary key
60
60 From E-R Model to Relational Model Generalization ---> relational schemas (3) Undergraduate studentPostgraduate student s# name project group# supervisor Student PStudent s#names# pgroup#s#supervisor 007James00713 008Peter 008Joan 009Mary00914 010Michael01015 UStudent Primary key Foreign key
61
61 From E-R Model to Relational Model Bibliography P. O’Neil, Database - Principles, Programming, Performance, chapters 5.1, 5.2, 5.3 R. Elmasri, S.B. Navathe, Fundamentals of Database Systems, chapter 21.1, 21.2 Bibliography P. O’Neil, Database - Principles, Programming, Performance, chapters 5.1, 5.2, 5.3 R. Elmasri, S.B. Navathe, Fundamentals of Database Systems, chapter 21.1, 21.2
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.