Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

21
Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

description

Chapter 7: Data Modeling Using the Entity Relationship (ER) Model. Database Design Phases. Instance of entities with attributes. Composite attribute:. Entity Type v.s. Entity Set. Relationship. Ternary Relationship. Can you think of another example?. - PowerPoint PPT Presentation

Transcript of Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Page 1: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Page 2: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Database Design Phases

Page 3: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Page 4: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Instance of entities with attributes

Page 5: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Composite attribute:

Page 6: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Entity Type v.s. Entity Set

Page 7: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Page 8: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Page 9: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Relationship

Page 10: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Ternary Relationship

Can you think of another example?

Page 11: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Role name of entity and Recursive Relationship

Page 12: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Cardinality ratio: 1:1

Page 13: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Cardinality ratio: M:N

Page 14: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Continued next page…

Symbols in ER Diagram

Page 15: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Page 16: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Relationship with higher degree

? why a ≠ b? Find an equivalent binary relationship

Page 17: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Page 18: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Exercise 1:1.What are the entities in the E-R diagram?2.Which queries could be answered using this database?

a. List all airports (airport_code) in New York State.b. List the airlines with frequent flier program.c. List airplanes (airplane_id) that could land on Minneapolis

Airport.d. List the airplanes (airplane_id) assigned to flight #5 for Delta

Airline.e. List all airports within 500 miles of Minneapolis Airport.f. List flight leg instances which were late by at least on hour.

3.In this database, how many fares are possible for a give flight?(A). at most one; (B). many

4.How many scheduled arrive time could a flight have for a given airport? (A). at most one; (B). many

Page 19: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

5. Which of the following have unique values in the database?① airport_code② airplane_id③ seat_no.④ leg_no.

Page 20: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

Exercise 2:The database needs to keep track of each U.S. STATE’s Name (e.g., ‘Texas’, ‘New York’, ‘California’) and include the Region of the State (whose domain is {‘Northwest’, ‘Midwest’, ‘Southeast’, ‘Southwest’, ‘West’}). Each CONGRESS_PERSON in the House of Representatives is described by his or her Name, plus the District represented, the Start_Date when the congressperson was first elected, and the political Party to which he or she belongs (whose domain is {‘Republican’, ‘Democrat’, ‘Independent’, ‘Other’}). The database keeps track of each BILL (i.e., proposed law), including the Bill_name, the Data_of_vote on the bill, whether the bill Passed_or_failed (whose domain is ‘yes’ or ‘no’), and the Sponsor (the congressperson(s) who sponsored-that is , proposed-the bill). The database also keeps track of how each congressperson voted on each bill (domain of Vote attribute is {‘yes’, ‘no’, ‘abstain’,’absent’}).

Page 21: Chapter 7: Data Modeling Using the Entity Relationship (ER) Model

Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley

1. Identify major entities and their identifying attributes

1. Identify major relationship among entities and their cardinality constraints (1:1, 1:N, M:N)

1. Design an ER schema diagram for this application.