IT420: Database Management and Organization ER Model: part 2 13 January 2006 Adina Crăiniceanu www.cs.usna.edu/~adina 1 ER Model Entities, attributes, identifiers HAS-A Relationships Degree: binary, ternary Maximum cardinality Minimum cardinality Weak entities ID-dependent entities; identifying relationships IS-A Relationships Inclusive, Exclusive 2 Goals of This Lecture Create ER model from user requirements 3 1 ERwin Symbol Summary 4 ERwin Symbol Summary (Continued) 5 Forms, Reports and ER Model User input: Forms Reports Discussions DB modeler: Entity-Relationship model Same entities, relationships under the surface 6 2 1:1 Strong Entity Relationships 7 1:1 Strong Entity Relationships 8 1:N Strong Entity Relationships 9 3 1:N Strong Entity Relationships 10 N:M Strong Entity Relationships 11 N:M Strong Entity Relationships 12 4 N:M Strong Entity Relationships 13 The Association Pattern Price column 14 Association Class 15 5 Entity vs. Attribute 16 Multi-valued Attribute Æ Entity 17 Recursive Relationships Recursive relationship: an entity has a relationship to itself 18 6 1:N Recursive Relationship 19 1:1 Recursive Relationship 20 N:M Recursive Relationship 21 7 Class Exercise Draw ER diagram for a database used to manage IT420 class (at least 3 entities) Specify entities, attributes, identifiers Specify relationships Specify cardinalities for relationships 22 Highline University The Highline University [HU] database will track such entities as: Colleges Departments Faculty Students We have gathered a set of HU reports that will be the source documents for a data model 23 The College Report 24 8 Data Model from the College Report 25 The Department Report 26 The DEPARTMENT / PROFESSOR Relatioship: Alternate Model 1: Using a 1:N Relationship 27 9 The DEPARTMENT / PROFESSOR Relatioship: Alternate Model 1: Using a 1:N Relationship 28 The DEPARTMENT / PROFESSOR Relatioship: Alternate Model 2: Using an N:M Relationship 29 The DEPARTMENT / PROFESSOR Relatioship: Alternate Model 3: Using an Association Pattern 30 10 The DEPARTMENT / PROFESSOR Relatioship: Alternate Model 4: Using a Association Pattern and a 1:N Relationship Chaired By /Chairs 31 The Department Major Report 32 Data Model with STUDENT Entity Chaired By /Chairs 33 11 The Student Acceptance Letter 34 Data Model with Advises Relationship Chaired By /Chairs 35 Final Data Model Chaired By /Chairs 36 12 ER Modeling: Case Study Drugwarehouse.com has offered you a free life-time supply of prescription drugs (no questions asked) if you design its database schema. Given the rising cost of health care, you agree. Here is the information that you gathered: Patients are identified by their SSN, and we also store their names and age Doctors are identified by their SSN, and we also store their names and specialty Each patient has one primary care physician Each doctor has at least one patient Doctors prescribe drugs for patients 37 13