CSIS 115 Database Design and Applications for Business Dr. Meg Fryling “Dr. Meg” Fall 2012 @SienaDrMeg #csis115
Agenda Homework (see next slide) Chapter 3 (100-105 only) & 5 – Data Modeling Data Modeling the Hockey League database
Homework Start Chapter 3 (skip 127-130) Start Chapter 6 Homework 3 Posted on Blackboard Due Weds, 10/10 by start of class Project – Part II Due Weds, 10/17 by start of class Notice: Next Quiz is Mon, 10/15
If a given customer can place only one order and a given order can be placed by at most one customer, which of the following should be indicated as the maximum cardinality between the two entities? A) 0:1 B) 1:1 C) 1:N D) N:1 E) N:M Answer: B
If a given customer can place many orders and a given order can be by one or more customers, which of the following should be indicated as the maximum cardinality between the two entities? A) 0:1 B) 1:1 C) 1:N D) N:1 E) N:M Answer: E
What does the symbol next to the ORDER entity indicate? A) A maximum cardinality of "zero" B) A maximum cardinality of "one" C) A minimum cardinality of "optional" D) A minimum cardinality of "required" E) None of the above Answer: C
An identifier may be ________. A) composite B) a single attribute C) a relationship D) unique E) nonunique All are true except C
When practical make identifiers unique! Makes translation to database
Cardinality Cardinality means “count,” and is expressed as a number. Maximum cardinality is the maximum number of entity instances that can participate in a relationship. Minimum cardinality is the minimum number of entity instances that must participate in a relationship. KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
Conceptual Database Design Data Modeling In-Class Activity Open Hockey League Activity Word doc from Blackboard Part I b Only Relationships with Maximum Cardinality
Minimum Cardinality Minimum cardinality is the minimum number of entity instances that must participate in a relationship. Minimums are generally stated as either zero or one: IF zero [0] THEN participation in the relationship by the entity is optional, and no entity instance must participate in the relationship. IF one [1] THEN participation in the relationship by the entity is mandatory, and at least one entity instance must participate in the relationship. KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
“Web for Students” Example What are some mandatory relationships? What are some optional relationships?
Indicating Minimum Cardinality Minimum cardinality of zero [0] indicating optional participation is indicated by placing an oval next to the optional entity. Minimum cardinality of one [1] indicating mandatory (required) participation is indicated by placing a vertical hash mark next to the required entity. KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
Minimum Cardinality Types “Web for Students” Example Mandatory-to-Mandatory (M-M) Relationship Optional-to-Optional (O-O) Relationship Optional-to-Mandatory (O-M or M-O) Relationship
Reading Minimum Cardinality Look toward the entity in question: IF you see an oval THEN that entity is optional minimum cardinality of zero [0] IF you see a vertical hash mark THEN that entity is mandatory (required) minimum cardinality of one [1] KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
Data Modeling Notation: IE Crow’s Foot I KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
Data Modeling Notation: IE Crow’s Foot 1:N KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
Data Modeling Notation: IE Crow’s Foot N:M KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
What does this mean? EMPLOYEE SKILL QUALIFICATION
Cardinality: Explicit maximum in relationship diamond 4 EMPLOYEE COMPUTER COMPUTER-ASSIGNMENT
Optional and Mandatory Participation Now you do it: STUDENT must declare a MAJOR Maximum of TWO majors. A major may no students majoring in it
Optional and Mandatory Participation Now you do it: STUDENT may declare a MINOR Maximum of TWO minors
Conceptual Database Design Data Modeling In-Class Activity Open Hockey League Activity Word doc from Blackboard Part I c Only Minimum Cardinality
Recursive Relationships It is possible for an entity to have a relationship to itself—this is called a recursive relationship. More about this later!
Weak vs. Strong Entities
Strong Entities Any entity whose existence does not depend on any other entity Can exist on its own ER Assistant calls these “Regular”
Weak Entities A weak entity cannot exist without the existence of another entity
Weak Entities An entity (child) whose identifier includes the identifier of another entity (parent). Is a logical extension or subunit of the parent: BUILDING : APARTMENT COURSE: CLASS_SECTION The minimum cardinality from the weak entity to the parent is always required. The parent record MUST exist in order for the child record to exist KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
Weak Entities Strong Entities Weak Entities What do the identifiers of the weak entities look like? Weak Entities KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall
Weak Entities See the mistake? Page 154 (11th Edition) Weak Entities KROENKE AND AUER - DATABASE PROCESSING, 11th Edition © 2010 Pearson Prentice Hall
Weak Entities This one is correct! KROENKE AND AUER - DATABASE PROCESSING, 12th Edition © 2012 Pearson Prentice Hall