CS422 Principles of Database Systems From ER to Relations Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture notes.

Slides:



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

Database Management Systems Chapter 3 The Relational Data Model (I) Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
CSCI 305 – Fall 2013 The Entity-Relationship Model Based on Slides by Prof. Brian King.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
1 Convert E/R to Relation May 18, Entity Set -> Relation Relation: Beers(name, manf) Beers name manf.
Databases : Relational Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman distributes.
Entity-Relationship Model
Chapter 4 Notes. Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
Design Principles: Faithfulness
Design Principles: Faithfulness
1 Relational Model and Translating ER into Relational.
DATABASE APPLICATION DEVELOPMENT SAK 3408 Database Design II (week 3)
The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes rows: tuples Complex file.
1 Announcement Recitation time  Before midterm: 6-7pm, by Earl Wagner  After midterm: 5-6pm, by Yi Qiao Newsgroup safe to subscribe  Will not cause.
Entity-Relationship Model and Diagrams (continued)
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
From E/R Diagrams to Relations. The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Source: slides by Jeffrey Ullman.
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
CS411 Database Systems Kazuhiro Minami
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
1 Entity-Relationship Model E/R Diagrams Weak Entity Sets Converting E/R Diagrams to Relations.
Databases : Entity-Relationship Model 2007, Fall Pusan National University Ki-Joune Li These slides are made from the materials that Prof. Jeffrey D. Ullman.
Database Management Systems Chapter 2 The Entity-Relationship Data Model Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
1 Entity-Relationship Model Chapter 2 Copyright : Jeff Ullman + Hank Korth.
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
 Primary keys allow entity sets and relationship sets to be expressed uniformly as relations  E/R diagram  collection of tables  For each entity set.
Data Modeling Translating E-R Diagrams to Relations
Relational Theory and Design
Databases 1 Fifth lecture. Entity-Relationship Model Diagrams Class hierarchies Weak entity sets From E/R diagrams to Relations 2.
Instructor: Jinze Liu Fall Phases of Database Design u Conceptual design begins with the collection of requirements and results needed from the.
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.
1 Unified Modeling Language. 2 UML  UML is designed to model software, but has been adapted as a database modeling language. – No multiway relationships.
CS422 Principles of Database Systems Convert ER Design to Relations Chengyu Sun California State University, Los Angeles.
CS422 Principles of Database Systems Entity-Relationship Model Chengyu Sun California State University, Los Angeles.
High-level Database Models Prof. Yin-Fu Huang CSIE, NYUST Chapter 4.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
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.
CS422 Principles of Database Systems Entity-Relationship Model
Introduction to Database Systems, CS420
Entity-Relationship Model
Modeling Constraints Extracting constraints is what modeling is all about. But how do we express them? Examples: Keys: social security number uniquely.
Relational Database Design by ER- and EER-to- Relational Mapping
COP4710 Database Systems E-R Model.
CS422 Principles of Database Systems Course Overview
CPSC-310 Database Systems
CSCI-100 Introduction to Computing
The Entity-Relationship Model
Instructor: Zhe He Department of Computer Science
Entity-Relationship Model and Diagrams (continued)
CPSC-310 Database Systems
CPSC-310 Database Systems
Order Database – ER Diagram
Transformation of E/R Diagram to Relation
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Chengyu Sun California State University, Los Angeles
The Relational Data Model
CS4433 Database Systems E-R Model.
CS 405G Introduction to Database Systems
CS 505: Intermediate Topics to Database Systems
CS4222 Principles of Database System
Session 5: Weak Entity Sets and ER Model to Relational ( )
CS 405G: Introduction to Database Systems
Presentation transcript:

CS422 Principles of Database Systems From ER to Relations Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture notes at

Relation NameManufacturer Winter BrewPete’s Bud LiteAnheuser-Busch Attributes (fields) Tuples (Records) (Rows) Beers Relation schema: Beers( name, manufacturer ) orBeers( name:string, manufacturer:string)

About Relational Model Attributes values must be atomic No order among attributes No order among tuples

Convert ER Diagram to Relations Entity sets Relationships Weak entity sets Subclasses

Entity Sets Drinkers nameaddr Beers namemanf Drinkers( name, addr ) Beers( name, manf )

Relationships DrinkersBeersLikes Favorite Married husband wife name addr name manf Buddies 1 2 ??

Converting Relationships – General Rules The resulting relation includes All key attributes from the entity sets involved in the relationship All the attributes of the relationship itself

Combining Relations Drinkers Beers Favorite Likes Drinkers and Likes ?? Drinkers and Favorite ?? Beers and Likes ?? Beers and Favorite ??

Converting Relationships – Combining Relations The relations converted from many-to- one and one-to-one relationships can be absorbed into the relation of the “many” side.

Weak Entity Set Example PlayersTeams Plays-on name numberlocation Teams( ?? ) Players( ?? ) Plays-on ??

Weak Entity Sets Relation for a weak entity set includes its complete key as well as it’s own non- key attributes A supporting relationship is redundant and yields no relation

Subclass Example Beers Ales isa name manf color

Subclasses Object-oriented approach One relation per class Each entity belongs to exact one relation ER approach One relation per class Each entity may appear in multiple relations NULL approach One relation per class hierarchy

Object-Oriented Approach namemanf BudAnheuser-Busch Beers namemanfcolor SummerbrewPete’sdark Ales

ER Approach namemanf BudAnheuser-Busch SummerbrewPete’s Beers namecolor Summerbrewdark Ales

NULL Approach namemanfcolor BudAnheuser-BuschNULL SummerbrewPete’sdark Beers

Discriminator nametypemanfcolor BudGeneralAnheuser-BuschNULL SummerbrewAlePete’sdark Beers Discriminator field

Another Subclass Example Movies titleyearlength isa Cartoons Murder- Mysteries typeweapon

Comparison of Subclass Conversion Approaches Constraints and data integrity Query performance Q1: find all beers made by Pete’s Q2: find colors of the ales made by Pete’s

Examples Receipt again Items, Customers, Waiters, and Orders Hierarchical categories Price that changes

Example: Survey Questions Four types of survey questions Single-choice Multiple-choice Single-answer Multiple-answer Database stores information about users, surveys, questions, and answers