1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.

Slides:



Advertisements
Similar presentations
Relational Model Table = relation. Column headers = attributes. Row = tuple Beers Relation schema = name(attributes) + other structure info., e.g., keys,
Advertisements

Database Management Systems Chapter 3 The Relational Data Model (I) Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
Chapter 3 : Relational Model
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 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.
1 Relational Model and Translating ER into Relational.
1 Entity-Relationship Model Slides by Jeffrey Ullman Modified by J. Welch to replace beers with candies.
CPSC-608 Database Systems Fall 2009 Instructor: Jianer Chen Office: HRBB 309B Phone: Notes #2.
The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes rows: tuples Complex file.
From ER Diagrams to the Relational Model Rose-Hulman Institute of Technology Curt Clifton.
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.
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.
Sept ER-to-Relational Mapping Principles ER-to-Relational Mapping And examples.
Fall 2001Arthur Keller – CS 1803–1 Schedule Today Oct. 2 (T) Relational Model. u Read Sections Assignment 1 due. Personal Letter of Introduction.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Source: slides by Jeffrey Ullman.
Winter 2002Arthur Keller – CS 1803–1 Schedule Today: Jan. 10 (TH) u Relational Model, Functional Dependencies. u Read Sections Jan. 15 (T) u Normal.
1 Entity-Relationship Model Diagrams Class hierarchies Weak entity sets.
CS411 Database Systems Kazuhiro Minami
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.
RELATIONAL DATA MODEL 1. 2 What is a Data Model? 1.Mathematical representation of data. wExamples: relational model = tables; semistructured model = trees/graphs.
Relational Databases CPSC 315 – Programming Studio Spring 2013 Project 1, Lecture 2 Slides adapted from those used by Jeffrey Ullman, via Jennifer Welch.
SE305 Database System Technology 23/10/2014 Quiz-2.
© 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
SAnta Clara UniversityHolliday – COEN 1782–1 Today’s Topic Today: u Constraints, Weak Entity Sets, Entity- Relationship Design. u Read Sections
CS 405G: Introduction to Database Systems Lecture 5: Logical Design by Relational Model Instructor: Chen Qian.
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.
Santa Clara UniversityHolliday – COEN 1783–1 Today’s Topic Today: u Relational Model, Functional Dependencies. u Read Sections Next time u Normal.
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.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
Entity-Relationship Model E/R Diagrams Converting E/R Diagrams to Relations.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Functional Dependencies.
CS 405G: Introduction to Database Systems Relations.
Jennifer Widom Relational Databases The Relational Model.
© D. Wong Ch. 3 (part 1)  Relational Model basics  From E/R diagram to Relations.
CS422 Principles of Database Systems Convert ER Design to Relations Chengyu Sun California State University, Los Angeles.
High-level Database Models Prof. Yin-Fu Huang CSIE, NYUST Chapter 4.
1 Database Design: DBS CB, 2 nd Edition Logical Database Model: Entity Relationship Model & Object Description Language & Unified Modeling Language Ch.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
1 Chapter 3 The Relational Data Model. 2 Contents u3.1 Basics of the Relational Model u3.2 From E/R diagrams to Relational Designs u3.4 Functional Dependencies.
CS422 Principles of Database Systems From ER to Relations Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture notes.
Introduction to Database Systems, CS420
Entity-Relationship Model
BBM 471 – Database Management Systems
COP4710 Database Systems Relational Model.
Cushing, Keller, UlmanJudy Cushing
CPSC-310 Database Systems
Instructor: Zhe He Department of Computer Science
CPSC 315 – Programming Studio Fall 2009 Project 1, Lecture 2
CPSC-310 Database Systems
Transformation of E/R Diagram to Relation
Relational Databases The Relational Model.
Relational Databases The Relational Model.
ER to Schema.
The Relational Data Model
CS 405G Introduction to Database Systems
CS 505: Intermediate Topics to Database Systems
Session 5: Weak Entity Sets and ER Model to Relational ( )
CS 405G: Introduction to Database Systems
Presentation transcript:

1 The Relational Data Model Tables Schemas Conversion from E/R to Relations

2 A Relation is a Table namemanf Corvette G.M. MaximaNissan cars Attributes (column headers) Tuples (rows)

3 Schemas uRelation schema = relation name and attribute list. wOptionally: types of attributes. wExample: cars(name, manf) or cars(name: string, manf: string) uDatabase = collection of relations. uDatabase schema = set of all relation schemas in the database.

4 Why Relations? uVery simple model. uOften matches how we think about data. uAbstract model that underlies SQL, the most important database language today.

5 From E/R Diagrams to Relations uEntity set -> relation. wAttributes -> attributes. uRelationships -> relations whose attributes are only: wThe keys of the connected entity sets. wAttributes of the relationship itself.

6 Entity Set -> Relation Relation: cars(model, manf) cars model manf

7 Relationship -> Relation driverscars Likes Likes(driver, car) Favorite Favorite(driver, car) Married husband wife Married(husband, wife) name addr name manf Mustangdies 1 2 Mustangdies(name1, name2)

8 Combining Relations uOK to combine into one relation: 1.The relation for an entity-set E 2.The relations for many-one relationships of which E is the “many.” uExample: drivers(name, addr) and Favorite(driver, car) combine to make driver1(name, addr, favcar).

9 Risk with Many-Many Relationships uCombining drivers with Likes would be a mistake. It leads to redundancy, as: name addr car Sally 123 Maple Mustang Sally 123 Maple Maxima Redundancy

10 Handling Weak Entity Sets uRelation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own, nonkey attributes. uA supporting relationship is redundant and yields no relation (unless it has attributes).

11 Example LoginsHostsAt name Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName, hostName2) Must be the same billTo At becomes part of Logins location

12 Subclasses: Three Approaches 1.Object-oriented : One relation per subset of subclasses, with all relevant attributes. 2.Use nulls : One relation; entities have NULL in attributes that don’t belong to them. 3.E/R style : One relation for each subclass: wKey attribute(s). wAttributes of that subclass.

13 Example cars Sports Car isa model manf RLR

14 Object-Oriented namemanf MustangNissan cars name manfRLR Corvette G.M. None Sports Good for queries like “find the RLR of Sports Car made by G.M..”

15 E/R Style namemanf Mustang Nissan Corvette G.M. Cars name RLR Corvette none Sports Cars Good for queries like “find all cars (including Sports Cars) made by G.M..”

16 Using Nulls namemanf RLR Mustang Nissan NULL Corvette G.M. none cars Saves space unless there are lots of attributes that are usually NULL.