Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Design 3: Advanced Data Modeling Concepts CS 320.

Similar presentations


Presentation on theme: "Database Design 3: Advanced Data Modeling Concepts CS 320."— Presentation transcript:

1 Database Design 3: Advanced Data Modeling Concepts CS 320

2 Composite Relationships  Relationship that has attributes  Always has M:M cardinality

3 Composite Relationships: Another Example

4 Decomposing a Composite Relationship Can always be decomposed into 2 1:M relationships!

5 Degree of a Relationship  Specifies the number of entities that participate in a relationship  Up until now, all relationships have been binary (2 entities)

6 Unary Relationships Entity has a relationship with itself

7 Ternary Relationships  Relationship exists among 3 entities

8 Generalization/Specialization Relationships Does not show cardinalities Supertype Subtypes

9 How common are non-binary relationships? Unary  Rare Ternary, generalization/specialization  More common than you would think

10 Homonyms Different attributes have the same name  Avoid!  This is why attributes should take their name from their entity

11 Synonyms Same attribute (field) has a different name in a different table Avoid! CANDY_PURCHASE CANDY_PRODUCT

12 Summary: Strategies for Developing ER Models How do you decide if an item is an entity or an attribute?  An item is an entity if: Multiple instances exist (or might exist) in the database  An item is an attribute if: It is a property of an entity instance Each entity instance has a single value of that property

13 Summary: Strategies for Associating an Attribute With the Correct Entity To which entity does an attribute belong?  Example: Is AdvisorName an attribute of a UniversityStudent instance?  Answer: Only if each advisor advises only one student. Otherwise, you are repeating the name multiple times.

14 Test Yourself: A composite relationship: a. Is always a 1:M relationship b. Is always a M:M relationship c. Can be made into a new entity d. Might have an attribute that belongs to the relationship e. All of the above except a

15 Test Yourself: A composite relationship: a. Is always a 1:M relationship b. Is always a M:M relationship c. Can be made into a new entity d. Might have an attribute that belongs to the relationship e. All of the above except a

16 Test Yourself: In an ER model, a relationship must always involve at least two entities. a. True b. False

17 Test Yourself: In an ER model, a relationship must always involve at least two entities. a. True b. False

18 Test Yourself: In an ER model, a relationship can never involve more than 3 entities. a. True b. False

19 Test Yourself: In an ER model, a relationship can never involve more than 3 entities. a. True b. False

20 Test Yourself: Naming an attribute CUST_ID in the CANDY_CUSTOMER table and CUSTOMER_ID in the CANDY_PURCHASE table illustrates creating a(n): a. Composite relationship b. Acronym c. Homonym d. Synonym e. None of the above

21 Test Yourself: Naming an attribute CUST_ID in the CANDY_CUSTOMER table and CUSTOMER_ID in the CANDY_PURCHASE table illustrates creating a(n): a. Composite relationship b. Acronym c. Homonym d. Synonym e. None of the above

22 Test Yourself: Suppose you create an attribute named DESC that describes products in the CANDY_PRODUCT table. Then you create a second attribute named DESC that describes customer types in the CANDY_CUST_TYPE table. This is a(n): a. Homonym b. Synonym c. Acronym d. Generalization/specialization e. None of the above

23 Test Yourself: Suppose you create an attribute named DESC that describes products in the CANDY_PRODUCT table. Then you create a second attribute named DESC that describes customer types in the CANDY_CUST_TYPE table. This is a(n): a. Homonym b. Synonym c. Acronym d. Generalization/specialization e. None of the above

24 UW- Eau Claire keeps data on students including student ID, student name, date of birth, campus address and phone number, permanent address and phone number, and email address. Data is also kept on courses that are offered. This data includes the course call ID (like ‘CS 320’), course name (like ‘Web Database Systems’), department (such as "Computer Science"), and the course description that appears in the catalog. Courses are offered multiple times. For each course section offering, the database stores the term offered (such as "Fall 2012", section number, day, time, location, and instructor. Instructor data includes instructor ID, name, email address, title, office location, and office phone number. Instructors teach course sections, and instructors also advise students. Students enroll in course sections, and grades are assigned for students in course sections. Students can have one or more instructors who act as advisors. Your Turn: Draw the ER Model for the following database application.

25 Solution


Download ppt "Database Design 3: Advanced Data Modeling Concepts CS 320."

Similar presentations


Ads by Google