advanced data modeling

Slides:



Advertisements
Similar presentations
Chapter 2: Entity-Relationship Model
Advertisements

Entity Relationship (ER) Modeling
Ch5: ER Diagrams - Part 1 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
Entity Relationship (ER) Modeling
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Entity Relationship (ER) Modeling
Entity Relationship (ER) Modeling
Systems Development Life Cycle
Text-Book Chapters (7 and 8) Entity-Relationship Model
1 © Prentice Hall, 2002 Chapter 3: Modeling Data in the Organization Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott, Fred.
System Analysis - Data Modeling
Chapter 4 Entity Relationship (ER) Modeling
Database Systems: Design, Implementation, and Management Tenth Edition
Chapter Five Data Modeling with the Entity-Relationship Model.
Chapter 2: Entity-Relationship Model (Continued)
Chapter 3 Data Modeling Using the Entity- Relationship (ER) Model Dr. Bernard Chen Ph.D. University of Central Arkansas.
Entity Relationship Modeling Objectives: To illustrate how relationships between entities are defined and refined. To know how relationships are incorporated.
Ch5: ER Diagrams - Part 2 Much of the material presented in these slides was developed by Dr. Ramon Lawrence at the University of Iowa.
1 © Prentice Hall, 2002 CMIS564: E/R Modeling Dr. Bordoloi Based on Chapter 3; Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B. Prescott,
Chapter 7 Data Modeling with Entity Relationship Diagrams Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Data Modeling Using the Entity- Relationship (ER) Model.
4 1 Chapter 4 Entity Relationship (ER) Modeling Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel.
©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.
Unit 3 Conceptual Data Modeling. Key Concepts Conceptual data modeling process Classes and objects Attributes Identifiers, candidate keys, and primary.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 4 Entity Relationship (ER) Modeling.
Chapter 4 Entity Relationship (ER) Modeling.  ER model forms the basis of an ER diagram  ERD represents conceptual database as viewed by end user 
Initial Design of Entity Types for the COMPANY Database Schema Based on the requirements, we can identify four initial entity types in the COMPANY database:
Database Design – Lecture 5 Conceptual Data Modeling – adding attributes.
Database Design 3: Advanced Data Modeling Concepts CS 320.
3 & 4 1 Chapters 3 and 4 Drawing ERDs October 16, 2006 Week 3.
Chapter 3 Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 4 Entity Relationship (ER) Modeling.
UNIT_2 1 DATABASE MANAGEMENT SYSTEM[DBMS] [Unit: 2] Prepared By Lavlesh Pandit SPCE MCA, Visnagar.
Databases Illuminated Chapter 3 The Entity Relationship Model.
AL-MAAREFA COLLEGE FOR SCIENCE AND TECHNOLOGY INFO 232: DATABASE SYSTEMS CHAPTER 4 ENTITY RELATIONSHIP (ER) MODELING Instructor Ms. Arwa Binsaleh 1.
Entity Relationship Modeling
Computing & Information Sciences Kansas State University Friday, 26 Sep 2008CIS 560: Database System Concepts Lecture 13 of 42 Friday, 26 September 2008.
INTRODUCTION TO DATA MODELING CS 260 Database Systems.
Chapter 3: Modeling Data in the Organization. Business Rules Statements that define or constrain some aspect of the business Assert business structure.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Module 8: Entity-Relationship.
Chapter 2: Entity-Relationship Model. 3.2 Chapter 2: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity.
Database Designsemester Slide 1 Database Design Lecture 7 Entity-relationship modeling Text , 7.1.
Chapter 2: Entity-Relationship Model
Entity Relationship (E-R) Model
Comp 1100 Entity-Relationship (ER) Model
Entity Relationship Modeling
Business System Development
Entity-Relationship Model
Tables and Their Characteristics
Database Design – Lecture 4
Chapter 7: Entity-Relationship Model
Entity-Relationship Modelling
Chapter 7 Entity-Relationship Model
Outline of the ER Model By S.Saha
Entity-Relationship Modeling
Module 8 – Database Design Using the E-R Model
Database Systems: Design, Implementation, and Management Tenth Edition
Entity-Relationship Modelling
Database Systems Instructor Name: Lecture-9.
Database Modeling using Entity Relationship Model (E-R Model)
Chapter 7: Entity-Relationship Model
Chapter 3: Modeling Data in the Organization
Weak Entity Sets An entity set that does not have a primary key is referred to as a weak entity set. The existence of a weak entity set depends on the.
Chapter 7: Entity-Relationship Model
ER MODELING Instructor: SAMIA ARSHAD
Entity Relationship (ER) Modeling
Chapter # 4 Entity Relationship (ER) Modeling.
Chapter 6b: Database Design Using the E-R Model
Presentation transcript:

advanced data modeling CS 260 Database Systems

Overview Weak entities Relationship degrees E-R diagrams Chen’s notation Crow’s foot notation Specialization and generalization

Weak Entities A “weak entity” is one that cannot be uniquely identified by its attributes alone A weak entity instance is dependent on (and may be thought of as a subcomponent of) an associated “strong entity” instance Referred to as an “identifying relationship” In other words, the weak entity does not make sense in the system without the strong entity In a relational database, a weak entity typically has a composite primary key that includes a foreign key to its strong entity’s primary key

Weak Entities Example Courses rarely change ids, titles, or credits, but are not taught every semester and may be taught in multiple sections We could represent the section, semester, and year as course attributes, but the other attributes will have redundant values Instead, make course a strong entity and section a weak entity A course entity has an id, title, and credits A section has a section number, semester, and year For a relational database, the section will include a foreign key to its associated course’s primary key, and all attributes will constitute the section’s primary key

Overview Weak entities Relationship degrees E-R diagrams Chen’s notation Crow’s foot notation Specialization and generalization

Relationship Degrees A relationship’s “degree” is the number of entities that participate in the relationship This differs from cardinalities which express the number of entity instances that participate in a relationship between two entities Relationship degree types Unary Binary N-ary

Relationship Degrees Unary relationships Occurs when an entity has a relationship with itself Example Suppose an employee entity has an attribute that indicates that employee’s supervisor If the employee entity is used to model supervisors as well, then the employee entity has a unary relationship

Relationship Degrees Binary relationships Occurs when exactly two entities participate in a given relationship Example Suppose student and course entities exist If a student enrolls in courses, then a binary relationship exists between the student and course entities

Relationship Degrees N-ary relationships Occurs when more than two entities participate in a given relationship Example Suppose student, course, and tutor entities exist If a course has both students and tutors, then an n-ary (more specifically a ternary) relationship exists

Relationship Degrees N-ary relationships can always be replaced by multiple binary relationships Multiple binary relationships may be preferable in situations where one of the entities that participates in the relationship could be absent This would result in null values that could be avoided if using multiple binary relationships May require more data Some relationships aren’t naturally binary, making an N-ary relationship clearer Additionally, constraints involving more than two entities may not be possible to model using multiple binary relationships

Relationship Degrees Equivalent binary and n-ary relationships The ternary relationship (a) clearly indicates that 3 entities participate in the relationship The multiple binary relationships (b) uses an extra entity (E) to facilitate the relationships

Relationship Degrees Identify the unary, binary, and n-ary relationships in our candy database If there are any n-ary relationships, how many entities participate in the relationship?

Sample Database (CANDY) CANDY_CUSTOMER CANDY_PURCHASE CANDY_CUST_TYPE CANDY_PRODUCT

Overview Weak entities Relationship degrees E-R diagrams Chen’s notation Crow’s foot notation Specialization and generalization

E-R Diagrams There are many different E-R diagram notations Chen Crow’s foot Bachman UML Plenty of others Each have their own advantages and disadvantages We’ll discuss and use Chen’s notation and Crow’s foot notation

Chen’s Notation Chen’s notation uses the following to illustrate E-R model components Entities are represented using rectangles Weak entities represented using a double rectangle Attributes are represented using ovals Keys are underlined Multivalued attributes are represented using a double oval Derived attributes are represented using a dotted oval Relationships are represented using diamonds Identifying relationships (relationships between strong and weak entities) are represented using a double diamond Lines are used to link attributes to entities, attributes to relationships, and entities to relationships

Chen’s Notation Indicating relationship participation Double line: mandatory participation Single line: optional participation Cardinality 1: at most a single instance participates in the relationship N (or M): multiple instances may participate in the relationship Alternatively, an entity’s cardinality “upper bound” (a limit on the number of instances that may participate in the relationship) may be specified above the line and its “lower bound” (a minimum number of instances that may participate in the relationship) may be specified below the line

Chen’s Notation Example

Overview Weak entities Relationship degrees E-R diagrams Chen’s notation Crow’s foot notation Specialization and generalization

Crow’s Foot Notation Crow’s foot notation uses the following to illustrate E-R model components Entities are represented using rectangles with 3 stacked compartments The top compartment contains the entity name Weak entities have no special representation Attributes are represented within their entity’s compartments The middle compartment contains the entity’s key(s), which may also include a key indicator (e.g. “PK”) The bottom compartment contains the entity’s other attributes Multivalued attributes have no special representation Derived attributes have no special representation Relationships are represented by dashed lines connecting entities A description of the relationship is provided with these lines Identifying relationships are represented using solid lines

Crow’s Foot Notation Indicating relationship participation Cardinality indicated by line endpoints Zero or more One or more One and only one Zero or 1 Additionally, an entity’s cardinality “upper bound” (a limit on the number of instances that may participate in the relationship) may be specified above the line and its “lower bound” (a minimum number of instances that may participate in the relationship) may be specified below the line

Crow’s Foot Notation Example

Chen’s and Crow’s Foot Comparison Chen’s notation is better suited for conceptual diagrams, as it’s design is more suited for systems that lack detail Crow’s foot notation is better suited for logical and physical diagrams, as it allows for details that apply in that domain However, it does not support n-ary relationships or relationship attributes As a result, entities must be used for these purposes, which we’ll see translates well to a relational database

Overview Weak entities Relationship degrees E-R diagrams Chen’s notation Crow’s foot notation Specialization and generalization

Specialization and Generalization Specialization occurs when multiple entities are designed to “reuse” the attributes in a single more generic entity Generalization occurs when a single entity is designed to encapsulate common attributes pulled out of multiple more specific entities Think inheritance in Java Specialization is a “top down” approach while generalization is a “bottom up” approach

Specialization and Generalization Example Overlapping specialization An entity instance can belong to multiple subentities Indicated here using multiple arrows Disjoint specialization An entity instance can belong to only one subentity Indicated here using a single arrow

Entity-Relationship Model Diagrams Create a Chen’s E-R diagram for the following system UW-Eau Claire keeps data on students including student ID, student name, campus address and phone number, permanent address and phone number, and email address Data is also kept on courses that are offered, including the course call ID (like ‘CS 260’), course name (like ‘Database Systems’), course description that appears in the catalog, the semester offered (such as "Fall 2014”), section number, day, time, location, and instructor Instructor data includes instructor ID, name, title, department, office location, and office phone number Instructors teach course sections, instructors advise students, and students enroll in course sections