Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Modeling and Entity- Relationship Model II. IST2102 I want a database to maintain departments in my company. Store information about my employees,

Similar presentations


Presentation on theme: "Data Modeling and Entity- Relationship Model II. IST2102 I want a database to maintain departments in my company. Store information about my employees,"— Presentation transcript:

1 Data Modeling and Entity- Relationship Model II

2 IST2102 I want a database to maintain departments in my company. Store information about my employees, their projects and assignments. I want …. $$$ User requirement A database YOUR JOB! Data Modeling (Ch.4) Data Modeling (Ch.4) Database Design (Ch.5)

3 Overview of Chapter 4: Data Modeling IST2103 Input: User requirement; Output: E-R Diagram Use Entity-Relationship Diagram (E-R Diagram) to capture all user requirements

4 Review of Previous Class: Draw an Entity IST2104 Entity Name  Attributes  Identifier 

5 Review of Previous Class: Maximum Cardinality Relationships are named and classified by their cardinality, which is a word that means count maximum cardinality is the maximum number of entity instances that may participate in a relationship instance — one, many or other some fixed number – BASKETBALL-TEAM and PLAYER could be 1:5 IST2105

6 Review of Previous Class: Crow’s Foot Notation IST2106 USERVIDEO USER CHANNEL EMPLOYEELOCKER OneMany (crow’s foot) Attention: do not misplace one and many notations An employee has (at most) one locker; a locker can belong to (at most) one employee A user can upload many videos; a video can be uploaded by (at most) one user A user can subscribe to many channels; a channel can be subscribed by many users upload subscribe

7 How to Determine Maximum Cardinality? IST2107 USERVIDEO USER CHANNEL EMPLOYEELOCKER Attention: do not misplace one and many notations An employee has (at most) one locker; a locker can belong to (at most) one employee A user can upload many videos; a video can be uploaded by (at most) one user A user can subscribe to many channels; a channel can be subscribed by many users upload subscribe User requirements Common Sense

8 Review Exercise Use crow’s foot notation to draw maximum cardinality on the following relationships: SALESPERSONORDER PRODUCTORDER EMPLOYEEDEPARTMENT (is manager of)

9 This Class Entity-Relationship Model – Entity, attribute, identifier, relationship – Maximum Cardinality: 1:1, 1:N, N:M – Minimum Cardinality: Optional, Mandatory Case Studies IST2109

10 Minimum Cardinality Minimum cardinality is the minimum number of entity instances that must participate in a relationship instance – typically assumes a value of zero (optional) or one (mandatory) IST21010 MandatoryOptional Crow’s foot notation

11 Minimum Cardinality IST21011 EMPLOYEELOCKER An employee may have a locker; a locker must belong to an employee MandatoryOptional Maximum cardinality notation is closer to entity Minimum cardinality notation is closer to the middle

12 Minimum Cardinality: Exercise IST21012 USERVIDEO MandatoryOptional What does the Minimum cardinality mean? (A) A user must upload a video; a video may belong to a user (B) A user may upload a video; a video must belong to a user (C) A user may upload a video; a video may belong to a user (D) A user must upload a video; a video must belong to a user

13 Minimum Cardinality: Exercise IST21013 Which design is most suitable? User requirements Common sense (A) (B) (C) (D) USER CHANNEL subscribe USER CHANNEL USER CHANNEL USER CHANNEL

14 In-Class Exercise: Minimum Cardinality IST21014 In-Class Exercise A-3 Add Minimum Cardinality symbols on the line of the relationship In-Class Exercise B-3 Add Minimum Cardinality symbols on the line of the relationship

15 Multiple Relationships between Entities IST21015 StudentID ClubID Name Email STUDENT CLUB ClubName Description president member Sometimes, there could multiple relationships with different semantic meanings between two entities. A club will have exactly one student as the president. Students can also become members of the club.

16 Multiple Relationships between Entities IST21016 UserID ProductID Name Email USER PRODUCT Name Description Sell Buy A product must be sold by exactly one user. A product may or may not have a buyer yet.

17 Summary IST21017 E-R Diagram: Entity-Relationship Diagram (1) entity; (2) identifier; (3) attributes; (4) relationship UserID Video ID Name Address Email USER VIDEO Title Description Length A complete E-R Diagram represented using Crow’s Foot notation: USER –> VIDEO: A user may upload zero to many videos VIDEO–> USER: A video must belong to exactly one user

18 IST21018 An online E-R diagram drawing tool: www.draw.io


Download ppt "Data Modeling and Entity- Relationship Model II. IST2102 I want a database to maintain departments in my company. Store information about my employees,"

Similar presentations


Ads by Google