1 From E-R Model to Relational Model. 2 Entity type sid#name address house#street pcode Student.

Slides:



Advertisements
Similar presentations
Convert ER to Relational Database Entity relation Entity relation Attributes attributes Attributes attributes Primary key primary key Primary key primary.
Advertisements

COP-5725 Practice Exercises
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Entity-Relationship Model Chapter 2.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
CIT 381 Slides part 3. Review: One-to-many and many-to-one One movie is stored on many videos – many videos are in one store. Both relationships are mandatory.
Data Modeling and Relational Database Design ISYS 650.
CS34311 Translating ER Schema to Relational Model.
Copyright © 2004 Pearson Education, Inc.. Chapter 11 Relational Database Design Algorithms and Further Dependencies.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Slide 7- 1.
COP5725 – Principles of Database Management Systems
Murali Mani The Relational Model. Murali Mani Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still.
CIT 381 More ER Modeling - review one-to-many - one-to-one - recursive relationships.
Copyright © 2004 Pearson Education, Inc.. Chapter 3 Data Modeling Using the Entity-Relationship Model.
Database Design Chapter 3.
CS34311 The Entity- Relationship Model Part II.. CS34312 Database Design Stages Application Requirements Conceptual Design Logical Design Physical Design.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- Mapping.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER-to- Relational Mapping.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Reduction of an E-R Schema to Tables A database which conforms to an E-R diagram can be represented.
Chapter 7 Relational Database Design by ER- and EER-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Ch 6: ER to Relational Mapping
The Entity-Relationship Model. 421B: Database Systems - ER Model 2 Overview of Database Design q Conceptual Design -- A first model of the real world.
the Entity-Relationship Model
1 SELECT statement. 2 Sample database Supplier Part supplies (0,n) colour s# snamep# pname amount citydob price qualitydate.
Chapter 5 1 © Prentice Hall, 2002 Chapter 5: Transforming EER Diagrams into Relations Mapping Regular Entities to Relations 1. Simple attributes: E-R attributes.
6.8 Case Study: E-R for Supplier-and-Parts Database
1 Translating E/R Diagrams into Relational Schemas.
Page 1 Topic 3 ER Model Chapter 14 of the date’s book Chapter 3 and 4 of Elmasri’s book CPS510 Database Systems Abdolreza Abhari School of Computer Science.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- to-Relational Mapping.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 7 Relational Database Design by ER- Mapping.
Chapter 3: Relational Model I Structure of Relational Databases Structure of Relational Databases Convert a ER Design to a Relational Database Convert.
PLUG IT IN 3 Fundamentals of Relational Database Operations.
ICS 321 Spring 2011 High Level Database Models Asst. Prof. Lipyeow Lim Information & Computer Science Department University of Hawaii at Manoa 2/7/20111Lipyeow.
1 E/R to relational mapping algorithm – overview Mapping algorithm step 1-7 Steen Jensen, autumn 2013.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Relational Model  Structure of Relational Databases  Normal forms (chap. 7)  Reduction of an E-R Schema to Relational (Sect. 2.9)  Relational.
The Relational Model1 ER-to-Relational Mapping and Views.
ER to Relational Translation John Ortiz. Lecture 5ER to Relational Translation2 Recall Database Design  Steps in database design Requirement Analysis.
Chapter 9: Logical Database Design and the Relational Model (ERD Mapping)
 Entity-relationship models (ERM) Entity-relationship models (ERM)  Simple E-R Diagram Simple E-R Diagram  Weak Entity Weak Entity  Strong Entity.
Jozef Kuper.  Describe a Database  Entities  Atributes  Relationships.
1 Translating ER Schema to Relational Model Instructor: Mohamed Eltabakh
ICOM 5016 – Introduction to Database Systems Lecture 9 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Slide Chapter 7 Relational Database Design by ER- to-Relational Mapping.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
Chapter 6 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
CS34311 Translating ER Schema to Relational Model.
Software School of Hunan University Database Systems Design Part III : Mapping ER Diagram to Relational Schema.
Relational Database Design by ER- and EER-to-Relational Mapping The main reference of this presentation is the textbook and PPT from : Elmasri & Navathe,
COMP3030 Database Management System Final Review
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Database Design Slide 1 Database Design Lecture 7 part 2 Mapping ERD to Tables.
ER- Relational Mapping (Based on Chapter 9 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Mapping ER Diagrams to Tables
LECTURE 1: Entity Relationship MODEL. Think before doing it! Like most of the software projects, you need to think before you do something. Before developing.
Introduction to Database Systems
Lecture (8) 1. Relational Database Design by ER- and EERR- to-Relational Mapping 2.
CS3431: C-Term Translating ER Schema to Relational Model Instructor: Mohamed Eltabakh
CS34311 Translating ER Schema to Relational Model.
Data Modeling AND ER MODELS.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Relational Database Design by ER- and EER- to-Relational Mapping.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Chapter 7 Relational Database Design by ER- and EERR-to-Relational Mapping Copyright © 2004 Pearson Education, Inc.
Relational Database Design by ER- and EERR-to-Relational Mapping
Relational Database Design by ER-to-Relational Mapping
EECS 647: Introduction to Database Systems
Relational Database Design (Top Down)
Relational Database Design by ER- and EER-to-Relational Mapping
Relational Database Design
Relational Database Design by ER-to-Relational Mapping
Presentation transcript:

1 From E-R Model to Relational Model

2 Entity type sid#name address house#street pcode Student

3 From E-R Model to Relational Model Entity type-----> Relational schema sid#name address house#street pcode Student sid# namehouse# street pcode Peter 10 Northfields Student

4 From E-R Model to Relational Model Entity type-----> Relational schema sid# namehouse# street pcode Peter 10 Northfields sid#name address house#street pcode Student

5 From E-R Model to Relational Model Entity type-----> Relational schema sid# namehouse# street pcode Peter 10 Northfields sid#name address house#street pcode Student Primary key

6 From E-R Model to Relational Model Instances of entities Kate Peter Paul Mary Student

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 Peter 123 Train Paul 34 Ross Mary 34 Ross 2056 Student

8 From E-R Model to Relational Model Multivalued attribute sid# name hobbies Student

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 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 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 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 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 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 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 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 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 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 From E-R Model to Relational Model One-to-One Relationship Department Chairperson name building# manages title (0,1)(1,1)

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 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 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 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 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 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 SQL /12/99 ObjectBin /12/97 title budget cdate Employee Project

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 SQL Paul SQL Mary ObjectBin e# ename proj-title SQL /12/99 ObjectBin /12/97 title budget cdate Employee Project

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 SQL Paul SQL Mary ObjectBin e# ename proj-title SQL /12/99 ObjectBin /12/97 title budget cdate Employee Project

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 SQL Paul SQL Mary ObjectBin e# ename proj-title SQL /12/99 ObjectBin /12/97 title budget cdate Employee Project Primary key

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 SQL Paul SQL Mary ObjectBin e# ename proj-title SQL /12/99 ObjectBin /12/97 title budget cdate Employee Project Primary key Primary key

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 SQL Paul SQL Mary ObjectBin e# ename proj-title SQL /12/99 ObjectBin /12/97 title budget cdate Employee Project Primary key Primary key Foreign key

31 From E-R Model to Relational Model Many-to-Many relationship Supplier Parts supplies s#name p# (0,m)(0,n)

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 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 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 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 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 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 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 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 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 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 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 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 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 From E-R Model to Relational Model Many-to-Many relationship---> relational schemas Many-to-Many relationship---> relational schemas SP s# p# 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 From E-R Model to Relational Model Attributes describing relationship Supplier Parts supplies s#name p# (0,m)(0,n) quantity

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 p# pname 10 bolt 20 nut 30 screw quantity

42 From E-R Model to Relational Model Weak entity Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner

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 PL window PL aisle US window Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Airplane Seat

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 PL window PL aisle US window Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Airplane Seat

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 PL window PL aisle US window Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Primary key Airplane Seat

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 PL window PL aisle US window Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Primary key Foreign key Airplane Seat

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 PL window PL aisle US window Airplane (1,n)(1,1) Seat has seat# position airplane# typeowner Primary key Foreign key Primary key Airplane Seat

48 From E-R Model to Relational Model Generalization

49 From E-R Model to Relational Model Generalization ---> relational schema (1)

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 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 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 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 From E-R Model to Relational Model Generalization ---> relational schemas (2) Undergraduate studentPostgraduate student s# name project group# supervisor Student

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 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 From E-R Model to Relational Model Generalization ---> relational schemas (3) Undergraduate studentPostgraduate student s# name project group# supervisor Student

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 007James Peter 008Joan 009Mary Michael01015 UStudent

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 007James Peter 008Joan 009Mary Michael01015 UStudent Primary key

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 007James Peter 008Joan 009Mary Michael01015 UStudent Primary key Foreign key

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