Winter 2002Arthur Keller – CS 1802–1 Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the keys of one.

Slides:



Advertisements
Similar presentations
Data Modeling. What are you keeping track of? You begin to develop a database by deciding what you are going to keep track of. Each thing that you are.
Advertisements

Constraints in Entity-Relationship Models Zaki Malik September 18, 2008.
1–1 Students Entity/Relationship Model Diagrams to represent designs. Entity like object, = “thing.” Entity set like class = set of “similar” entities/objects.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
ENTITY RELATIONSHIP MODELLING
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Chapter 4 Notes. Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
Design Principles: Faithfulness
Weak Entity Sets. Occasionally, entities of an entity set need “help” to identify them uniquely. Example. Crews might have a number and some description,
Weak Entity Sets. Occasionally, entities of an entity set need “help” to identify them uniquely. Entity set E is weak if in order to identify entities.
Design Principles: Faithfulness
Database Design and the E-R Model Chapter 7 [1 of 2]
DATABASE APPLICATION DEVELOPMENT SAK 3408 Database Design II (week 3)
From ER Diagrams to the Relational Model Rose-Hulman Institute of Technology Curt Clifton.
A four-way Relationship
Fall 2001Arthur Keller – CS 1802–1 Schedule Today Sep. 25 (T) u More Entity-Relationship Model. u Read Sections Note: Sep. 27 (TH) Class cancelled.
The Entity-Relationship Data Model
Fall 2001Arthur Keller – CS 1803–1 Schedule Today Oct. 2 (T) Relational Model. u Read Sections Assignment 1 due. Personal Letter of Introduction.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
1 Conceptual Design with ER Model Lecture #2. 2 Lecture Outline Logistics Steps in building a database application Conceptual design with ER model.
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Winter 2002Arthur Keller – CS 1802–1 Schedule Today: Jan. 8 (T) u Weak Entity Sets, Entity-Relationship Design. u Read Sections Jan. 10 (TH) u.
Entity/Relationship Modelling
CS411 Database Systems Kazuhiro Minami
Database Management System Lecture 6 The Relational Database Model – Keys, Integrity Rules.
Introduction to Database Systems Conceptual Modeling
Relational databases and third normal form As always click on speaker notes under view when executing to get more information!
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 3 Introduction to a First Course in Database Systems.
Databases : Entity-Relationship Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
Database Management Systems Chapter 2 The Entity-Relationship Data Model Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
ER Data Models Ctd. CSET 3300.
1 Entity-Relationship Model Chapter 2 Copyright : Jeff Ullman + Hank Korth.
1 Session 2 Welcome: The fifth learning sequence “ Entity-Relationship Model -2“ E-R Model Recap : In the previous learning sequence, we discussed the.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Continued)
Tallahassee, Florida, 2015 COP4710 Database Systems E-R Model Fall 2015.
© D. Wong Ch. 2 Entity-Relationship Data Model (continue)  Data models  Entity-Relationship diagrams  Design Principles  Modeling of constraints.
Entity-Relationship Model
Data Modeling Translating E-R Diagrams to Relations
SAnta Clara UniversityHolliday – COEN 1782–1 Today’s Topic Today: u Constraints, Weak Entity Sets, Entity- Relationship Design. u Read Sections
Winter 2006Cushing Keller UllmanJudy Cushing2–1 Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 2 Introduction to a First Course in Database Systems.
Home Work. Design Principles and Weak Entity Sets.
Databases 1 Fifth lecture. Entity-Relationship Model Diagrams Class hierarchies Weak entity sets From E/R diagrams to Relations 2.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 4 Introduction to a First Course in Database Systems.
Entity-Relationship Model E/R Diagrams Converting E/R Diagrams to Relations.
CS 405G: Introduction to Database Systems Relations.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity- Relationship Model (Continued)
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
IMS 4212: Normalization 1 Dr. Lawrence West, Management Dept., University of Central Florida Normalization—Topics Functional Dependency.
CS 405G Introduction to Database Systems Lecture 3: ER Model Instructor: Chen Qian.
High-level Database Models Prof. Yin-Fu Huang CSIE, NYUST Chapter 4.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
IT 5433 LM3 Relational Data Model. Learning Objectives: List the 5 properties of relations List the properties of a candidate key, primary key and foreign.
Database Design and Programming Jan Baumbach Adopted from previous slides of Peter Schneider-Kamp.
CS422 Principles of Database Systems Entity-Relationship Model Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture.
Introduction to Database Systems, CS420
Entity/Relationship Modelling
Entity-Relationship Model
Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the keys of one or more E.S.’s to which E is linked.
Constraints in Entity-Relationship Models
CPSC-310 Database Systems
Entity/Relationship Model
Instructor: Zhe He Department of Computer Science
Session 2 Welcome: The fifth learning sequence
CS4433 Database Systems E-R Model.
Database Management system
Database Management system
CS 405G: Introduction to Database Systems
Presentation transcript:

Winter 2002Arthur Keller – CS 1802–1 Weak Entity Sets Sometimes an E.S. E ’s key comes not (completely) from its own attributes, but from the keys of one or more E.S.’s to which E is linked by a supporting many-one relationship. Called a weak E.S. Represented by putting double rectangle around E and a double diamond around each supporting relationship. Many-one-ness of supporting relationship (includes 1-1) essential. u With many-many, we wouldn't know which entity provided the key value. “Exactly one” also essential, or else we might not be able to extract key attributes by following the supporting relationship.

Winter 2002Arthur Keller – CS 1802–2 Example: Logins ( Addresses) Login name = user name + host name, e.g., A “login” entity corresponds to a user name on a particular host, but the passwd table doesn’t record the host, just the user name, e.g., ark. Key for a login = the user name at the host (which is unique for that host only) + the IP address of the host (which is unique globally). Design issue: Under what circumstances could we simply make login-name and host-name be attributes of logins, and dispense with the weak name

Winter 2002Arthur Keller – CS 1802–3 Example: Chain of “Weakness” Consider IP addresses consisting of a primary domain (e.g., edu ), subdomain (e.g., ucsc ), and host (e.g., soe ). Key for primary domain = its name. Key for secondary domain = its name + name of primary domain. Key for host = its name + key of secondary domain = its name + name of secondary domain + name of primary domain. 2ndary Domains Primary In1 name In2 name

Winter 2002Arthur Keller – CS 1802–4 All “Connecting” Entity Sets Are Weak In this special case, where bar and beer determine a price, we can omit price from the key, and remove the double diamond from ThePrice. Better: price is attribute of BBP. BarsBeers The- Bar Price The- Beer The- Price BBP The- Bar The- Beer The- Price namemanfnameaddrprice

Winter 2002Arthur Keller – CS 1802–5 Relationship To Weak Entities Consider a relationship, Ordered, between two entity sets, Buyer and Product How can we add Shipments to the mix? is wrong. Why? BuyerProduct Ordered Qty BuyerProduct Ordered Qty Shipment Name UPC Name UPC ID

Winter 2002Arthur Keller – CS 1802–6 Solution: make Ordered into a weak entity set. And then add Shipment. BuyerProduct Qty BuyerProduct Shipment Name UPC Name UPC ID Ordered OB OP Qty Ordered OB OP Part of Qty Shipped Part-of is many-many and not a weak relationship!

Winter 2002Arthur Keller – CS 1802–7 Design Principles Setting: client has (possibly vague) idea of what he/she wants. You must design a database that represents these thoughts and only these thoughts. Avoid redundancy = saying the same thing more than once. Wastes space and encourages inconsistency. Example Good: BeersManfs ManfBy nameaddrname

Winter 2002Arthur Keller – CS 1802–8 Example Bad: repeats manufacturer address for each beer they manufacture. Bad: manufacturer’s name said twice. BeersManfs ManfBy nameaddrnamemanf Beers namemanf Manf addr

Winter 2002Arthur Keller – CS 1802–9 The design schema should enforce as many constraints as possible. u Don't rely on future data to follow assumptions. Example If registrar wants to associate only one instructor with a course, don't allow sets of instructors and count on departments to enter only one instructor per course. Use Schema to Enforce Constraints

Winter 2002Arthur Keller – CS 1802–10 Entity Sets Vs. Attributes You may be unsure which concepts are worthy of being entity sets, and which are handled more simply as attributes. Especially tricky for the class design project, since there is a temptation to create needless entity sets to make project “larger.” Wrong: Right: BeersManfs ManfBy name Beers namemanf

Winter 2002Arthur Keller – CS 1802–11 Intuitive Rule for E.S. Vs. Attribute Make an entity set only if it either: 1.Is more than a name of something; i.e., it has nonkey attributes or relationships with a number of different entity sets, or 2.Is the “many” in a many-one relationship.

Winter 2002Arthur Keller – CS 1802–12 Example The following design illustrates both points: Manfs deserves to be an E.S. because we record addr, a nonkey attribute. Beers deserves to be an E.S. because it is at the “many” end. u If not, we would have to make “set of beers” an attribute of Manfs – something we avoid doing, although some may tell you it is OK in E/R model. BeersManfs ManfBy nameaddrname

Winter 2002Arthur Keller – CS 1802–13 Don't Overuse Weak E.S. There is a tendency to feel that no E.S. has its entities uniquely determined without following some relationships. However, in practice, we almost always create unique ID's to compensate: social-security numbers, VIN's, etc. The only times weak E.S.'s seem necessary are when: a) We can't easily create such ID's; e.g., no one is going to accept a “species ID” as part of the standard nomenclature (species is a weak E.S. supported by membership in a genus). b) There is no global authority to create them, e.g., crews and studios.