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.

Slides:



Advertisements
Similar presentations
Constraints in Entity-Relationship Models Zaki Malik September 18, 2008.
Advertisements

1–1 Students Entity/Relationship Model Diagrams to represent designs. Entity like object, = “thing.” Entity set like class = set of “similar” entities/objects.
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 APPLICATION DEVELOPMENT SAK 3408 Database Design II (week 3)
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.
Database Design Concepts INFO1408 Term 2 week 1 Data validation and Referential integrity.
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.
CS411 Database Systems Kazuhiro Minami
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.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
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
ER Data Models Ctd. CSET 3300.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Continued)
Entity-Relationship Model
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.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
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.
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.
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.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity- Relationship Model (Continued)
High-level Database Models Prof. Yin-Fu Huang CSIE, NYUST Chapter 4.
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.
Hele-Mai Haav: CSC210-Spring*01 CSC230-Spring*03 Database Design.
Introduction to Database Systems, CS420
Contents Design Process Modeling Constraints E-R Diagram Design Issues
Comp 1100 Entity-Relationship (ER) Model
Entity/Relationship Modelling
Let try to identify the conectivity of these entity relationship
Entity-Relationship Model
COP4710 Database Systems E-R Model.
MIS2502: Data Analytics Relational Data Modeling
Database Normalization
02: ER Model Ch 4.1 – 4.4 Optionally, begin with Ch 2.1.
Constraints in Entity-Relationship Models
CPSC-310 Database Systems
Example Question–Is this relation Well Structured? Student
CPSC-608 Database Systems
Entity/Relationship Model
Instructor: Zhe He Department of Computer Science
CPSC-310 Database Systems
CPSC-310 Database Systems
Data Modelling Introduction
Teaching slides Chapter 8.
MIS2502: Data Analytics Relational Data Modeling
MIS2502: Data Analytics Relational Data Modeling
Database Design Chapters 17 and 18.
Session 2 Welcome: The fifth learning sequence
Database Modeling using Entity Relationship Model (E-R Model)
CS4433 Database Systems E-R Model.
CS 505: Intermediate Topics to Database Systems
CPSC-608 Database Systems
MIS2502: Data Analytics Relational Data Modeling 2
Database Management system
Database Management system
Implementation of Learning Systems
CS 405G: Introduction to Database Systems
Session 5: Weak Entity Sets and ER Model to Relational ( )
CS 405G: Introduction to Database Systems
Presentation transcript:

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. 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 2002 Judy Cushing

Schedule Finish E/R slides from Monday Weak Entity Sets, Design Principles Sample Database Design -- Eu-Rent Project Installment 1 – due Monday Asst 1 – due Wednesday Help Sessions – Tuesday, ACC 1:30-2:30 Dan ? 2-3 or 3-4 Jeff? Winter 2002 Judy Cushing

Example: Logins (Email Addresses) Login name = user name + host name, e.g., ark@soe.ucsc.edu. 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 E.S.? name name @ @ Logins Hosts Winter 2002 Judy Cushing

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. name name name @ @ In2 In1 Hosts 2ndary Domains Primary Domains Winter 2002 Judy Cushing

All “Connecting” Entity Sets Are Weak BBP BBP The- Bar The- Beer The- Price The- Bar The- Beer The- Price Bars Beers Beers name addr name manf price 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. Winter 2002 Judy Cushing

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? UPC Ordered Buyer Product Name Qty UPC Ordered Buyer Product Qty ID Name Shipment Winter 2002 Judy Cushing

Solution: make Ordered into a weak entity set. UPC Solution: make Ordered into a weak entity set. And then add Shipment. Buyer Ordered Product OB OB OP OP Name Qty UPC Buyer Ordered Product OB OB OP OP Name Qty Ordered ID Part of Shipment Part-of is many-many and not a weak relationship! Qty Shipped Winter 2002 Judy Cushing

Design Principles Avoid redundancy Example 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: name name addr ManfBy Beers Manfs Winter 2002 Judy Cushing

Example Bad: repeats manufacturer address for each beer they manufacture. Bad: manufacturer’s name said twice. name manf Beers Manf addr name manf name addr ManfBy Beers Manfs Winter 2002 Judy Cushing

Use Schema to Enforce Constraints The design schema should enforce as many constraints as possible. 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. Winter 2002 Judy Cushing

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: name name ManfBy Beers Manfs name manf Beers Winter 2002 Judy Cushing

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

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. 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. name name addr ManfBy Beers Manfs Winter 2002 Judy Cushing

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: 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). There is no global authority to create them, e.g., crews and studios. Winter 2002 Judy Cushing

Classroom Design Exercise (or EuRent) Imagine we are creating a database for a dorm, which includes a cooperative kitchen. We want to record certain information about each resident. What? Not all residents belong to the kitchen coop. Those that do interact in various ways: They take turns at various jobs: preparer, cleanup, buyer (for supplies). No one should have two jobs on one day. They may or may not be vegetarian. Each meal must have at least one vegetarian entry. They pay fees to the coop. For each meal, there is a menu. Each menu item requires certain ingredients, which must be on hand. Winter 2002 Judy Cushing

If There's Time… Suppose we only need to have a vegetarian choice for a given meal if there is at least one vegetarian taking that meal. How would we modify the database schema? Winter 2002 Judy Cushing