1 Session 2 Welcome: The fifth learning sequence “ Entity-Relationship Model -2“ E-R Model Recap : In the previous learning sequence, we discussed the.

Slides:



Advertisements
Similar presentations
Chapter 6: Entity-Relationship Model (part I)
Advertisements

Constraints in Entity-Relationship Models Zaki Malik September 18, 2008.
Conceptual Data Modeling: ER
Text-Book Chapters (7 and 8) Entity-Relationship Model
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.
Database Design and the E-R Model Chapter 7 [1 of 2]
1 Entity-Relationship Model Slides by Jeffrey Ullman Modified by J. Welch to replace beers with candies.
CS157A Lecture 3 ER Diagram Prof. Sin-Min Lee Department of Computer Science San Jose State University.
Databases Revision.
DATABASE APPLICATION DEVELOPMENT SAK 3408 Database Design II (week 3)
Entity-Relationship Data Model CS 157A Professor Sin-Min Lee Student: Yen-Chu Pan.
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Week 3 Outline Overview of Database Design Process Example Database Application (COMPANY) ER Model.
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
Chapter 2: Entity-Relationship Model (Continued)
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
CS411 Database Systems Kazuhiro Minami
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model.
the Entity-Relationship Model
Outline What is ER Model? And Why? Example COMPANY Database
Database System Concepts, 5th Ed. Chapter 6: Entity-Relationship Model.
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Data Modeling Using the Entity-Relationship (ER) Model
Chapter 11 (I) CIS458 Sungchul Hong. Chapter 11 - Objectives How to use Entity–Relationship (ER) modelling in database design. Basic concepts associated.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
Data Modeling Using the Entity-Relationship
Lecture On Database Analysis and Design By- Jesmin Akhter Lecturer, IIT, Jahangirnagar University.
Databases : Entity-Relationship Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman.
ER Data Models Ctd. CSET 3300.
1 Entity-Relationship Model Chapter 2 Copyright : Jeff Ullman + Hank Korth.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping.
Chapter 7 Database Design and The E–R Model. 2 Goals n Facilitate DB design and represent the overall logical structure of the DB. n Definition Entities.
1 Session 2 Welcome: The seventh learning sequence “ Reduction of an EER schema to tables“ Recap : In the previous learning sequence, we discussed the.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts DB Schema Design: the Entity-Relationship Model What’s the use of the E-R model? Entity Sets.
Entity-Relationship Model Using High-Level Conceptual Data Models for Database Design Entity Types, Sets, Attributes and Keys Relationship Types, Sets,
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Chapter 3 Data Modeling Using the Entity-Relationship (ER) Model Copyright © 2004 Pearson Education, Inc.
Chapter 2 : Entity-Relationship Model Entity Sets Relationship Sets Design Issues Mapping Constraints Keys E-R Diagram Extended E-R Features Design of.
Entity-Relationship Model
ICOM 5016 – Introduction to Database Systems Lecture 9 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-03 Introduction –Data Models Lectured by, Jesmin Akhter.
ICOM 5016 – Introduction to Database Systems Lecture 5 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Data Modeling Using the Entity-Relationship (ER) Data Model (Based on Chapter 3 in Fundamentals of Database Systems by Elmasri and Navathe, Ed. 3)
Copyright © 2007 Ramez Elmasr and Shamkant B. Navathei Slide 3- 1.
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
Database Systems – ER Diagrams EXAMPLE COMPANY DATABASE Requirements of the Company (oversimplified to illustrate) The company is organized into DEPARTMENTs.
Chapter 2 Data Modeling Using the Entity-Relationship (ER) Model Copyright © 2004 Pearson Education, Inc.
Data Modeling Using the Entity-Relationship (ER) Data Model.
Data Modeling Using the Entity- Relationship (ER) Model.
Chapter 3: Data Modeling Using the Entity-Relationship (ER) Data Model
CSE 412/598 DATABASE MANAGEMENT COURSE NOTES 3. ENTITY-RELATIONSHIP CONCEPTUAL MODELING Department of Computer Science & Engineering Arizona State University.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan Lecture-03 Introduction –Data Models Lectured by, Jesmin Akhter.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Chapter 2: Entity-Relationship Model Entity Sets Relationship Sets Mapping Constraints Keys.
Chapter 2: Entity-Relationship Model. 3.2 Chapter 2: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Lecture 26 Enterprise Systems Development ( CSC447 ) COMSATS Islamabad Muhammad Usman, Assistant Professor.
CS 405G Introduction to Database Systems Lecture 3: ER Model Instructor: Chen Qian.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 16 July 26,2012 Data Modeling using the Entity Relationship.
Contents Design Process Modeling Constraints E-R Diagram Design Issues
CS4222 Principles of Database System
Data Modeling Using the Entity- Relationship (ER) Model
Database Management Systems
Entity Relationship Model
College of Arts & Science Computer Science Department
Entity-Relationship Model
Constraints in Entity-Relationship Models
Session 2 Welcome: The fifth learning sequence
Chapter 6: Entity-Relationship Model
Presentation transcript:

1 Session 2 Welcome: The fifth learning sequence “ Entity-Relationship Model -2“ E-R Model Recap : In the previous learning sequence, we discussed the introduction to E-R model. Present learning: We shall explore the following definitions: - Keys in E-R MODEL. - Weak Entity. - Design techniques.

2 Entity-Relationship Model 2 Keys Weak entity sets

3 Keys uA key is a set of attributes for one entity set such that no two entities in this set agree on all the attributes of the key. wIt is allowed for two entities to agree on some, but not all, of the key attributes. uWe must designate a key for every entity set.

4 Keys in E/R Diagrams uUnderline the key attribute(s).

5 Example: a Multi-attribute Key Courses deptnumberhoursroom Note that hours and room could also serve as a key, but we must select only one key.

Keys uA super key of an entity set is a set of one or more attributes whose values uniquely determine each entity. uA candidate key of an entity set is a minimal super key wCustomer-id is candidate key of customer waccount-number is candidate key of account uAlthough several candidate keys may exist, one of the candidate keys is selected to be the primary key.

Chapter 3-7 Types of Attributes (1) uSimple wEach entity has a single atomic value for the attribute. For example, SSN or Sex. uComposite wThe attribute may be composed of several components. For example, Address (Apt#, House#, Street, City, State, ZipCode, Country) or Name (FirstName, MiddleName, LastName). Composition may form a hierarchy where some components are themselves composite. uMulti-valued wAn entity may have multiple values for that attribute. For example, Color of a CAR or PreviousDegrees of a STUDENT. Denoted as {Color} or {PreviousDegrees}.

Chapter 3-8 Types of Attributes (2) uIn general, composite and multi-valued attributes may be nested arbitrarily to any number of levels although this is rare. For example, PreviousDegrees of a STUDENT is a composite multi-valued attribute denoted by {PreviousDegrees (College, Year, Degree, Field)}.

Chapter 3-9 ENTITY SET corresponding to the ENTITY TYPE CAR car 1 ((ABC 123, TEXAS), TK629, Ford Mustang, convertible, 1999, (red, black)) car 2 ((ABC 123, NEW YORK), WP9872, Nissan 300ZX, 2-door, 2002, (blue)) car 3 ((VSY 720, TEXAS), TD729, Buick LeSabre, 4-door, 2003, (white, blue)). CAR Registration(RegistrationNumber, State), VehicleID, Make, Model, Year, (Color)

Chapter 3-10 SUMMARY OF ER-DIAGRAM NOTATION FOR ER SCHEMAS Meaning ENTITY TYPE WEAK ENTITY TYPE RELATIONSHIP TYPE IDENTIFYING RELATIONSHIP TYPE ATTRIBUTE KEY ATTRIBUTE MULTIVALUED ATTRIBUTE COMPOSITE ATTRIBUTE DERIVED ATTRIBUTE TOTAL PARTICIPATION OF E 2 IN R CARDINALITY RATIO 1:N FOR E 1 :E 2 IN R STRUCTURAL CONSTRAINT (min, max) ON PARTICIPATION OF E IN R Symbol E1E1 R E2E2 E1E1 R E2E2 R (min,max) E N

Participation of an Entity Set in a Relationship n Total participation (indicated by double line): every entity in the entity set participates in at least one relationship in the relationship set n E.g. participation of loan in borrower is total n every loan must have a customer associated to it via borrower n Partial participation: some entities may not participate in any relationship in the relationship set n E.g. participation of customer in borrower is partial

Participation of an Entity Set in a Relationship

13 Weak Entity Sets uOccasionally, entities of an entity set need “help” to identify them uniquely. uEntity set E is said to be weak if in order to identify entities of E uniquely, we need to follow one or more many- one relationships from E and include the key of the related entities from the connected entity sets.

14 Example uname is almost a key for football players, but there might be two with the same name. unumber is certainly not a key, since players on two teams could have the same number. uBut number, together with the Team related to the player by Plays-on should be unique.

15 In E/R Diagrams PlayersTeams Plays- on name number Double diamond for supporting many-one relationship. Double rectangle for the weak entity set.

16 Weak Entity-Set Rules uA weak entity set has one or more many-one relationships to other (supporting) entity sets. wNot every many-one relationship from a weak entity set need be supporting. uThe key for a weak entity set is its own underlined attributes and the keys for the supporting entity sets. wE.g., player-number and team-name is a key for Players in the previous example.

Weak Entity-Set (Cont.) uAn entity set that does not have a primary key is referred to as a weak entity set. uThe existence of a weak entity set depends on the existence of a identifying entity set w it must relate to the identifying entity set via a total, one- to-many relationship set from the identifying to the weak entity set wIdentifying relationship depicted using a double diamond uThe discriminator (or partial key) of a weak entity set is the set of attributes that distinguishes among all the entities of a weak entity set. uThe primary key of a weak entity set is formed by the primary key of the strong entity set on which the weak entity set is existence dependent, plus the weak entity set’s discriminator.

Weak Entity Sets (Cont.) uNote: the primary key of the strong entity set is not explicitly stored with the weak entity set, since it is implicit in the identifying relationship. uIf loan-number were explicitly stored, payment could be made a strong entity, but then the relationship between payment and loan would be duplicated by an implicit relationship defined by the attribute loan- number common to payment and loan

Weak Entity Sets (Cont.) uWe depict a weak entity set by double rectangles. uWe underline the discriminator of a weak entity set with a dashed line. upayment-number – discriminator of the payment entity set uPrimary key for payment – (loan- number, payment-number)

Organization Scenario 20

Chapter 3-21 ER DIAGRAM – Entity Types are: EMPLOYEE, DEPARTMENT, PROJECT, DEPENDENT

22 Design Techniques 1.Avoid redundancy. 2.Don’t use an entity set when an attribute will do.

23 Avoiding Redundancy uRedundancy occurs when we say the same thing in two different ways. uRedundancy wastes space and (more importantly) encourages inconsistency. wThe two instances of the same fact may become inconsistent if we change one and forget to change the other, related version.

24 Example: Good StudentsTeacher Advises name This design gives the address of each teacher exactly once. nameaddr

25 Example: Bad StudentTeachers Advises name This design states the adviser of a student twice: as an attribute and as a related entity. name Adviser addr

26 Example: Bad Students name This design repeats the adviser’s address once for each student; loses the address if there are temporarily no students for an adviser. AdviserAdviser-Address

27 Entity Sets Versus Attributes uAn entity set should satisfy at least one of the following conditions: wIt is more than the name of something; it has at least one non key attribute. or wIt is the “many” in a many-one or many- many relationship.

28 Example: Good StudentsTeacher Advises name Teachers deserves to be an entity set because of the nonkey attribute address. Students deserves to be an entity set because it is the “many” of the many-one relationship Advises. nameaddress

29 Example: Good Students name There is no need to make the adviser an entity set, because we record nothing about advisers besides their name. Adviser

30 Example: Bad StudentsTeachers Advises name Since the teacher is nothing but a name, and is not at the “many” end of any relationship, it should not be an entity set. name

31 E-R Diagram Summary: In this learning sequence, we discussed the keys and weak entity sets in Entity- Relationship diagram.

32 END