The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes rows: tuples Complex file.

Slides:



Advertisements
Similar presentations
High-Level Database Models Spring 2011 Instructor: Hassan Khosravi.
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.
Database Systems The Relational Data Model
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.
Midterm Review II. Redundancy. –Information may be repeated unnecessarily in several tuples. –E.g. length and filmType. Update anomalies. –We may change.
Design Principles: Faithfulness
Entity-Relationship Model. The process of designing a database begins with: –an analysis of what information the database must hold, and –the relationships.
Design Principles: Faithfulness
1 Relational Model and Translating ER into Relational.
Relational Model CS 157A Prof. Sin-Min Lee By Truc Truong.
Closure The closure of {B 1 …B k } under the set of FDs S, denoted by {B 1 …B k } +, is defined as follows: {B 1 …B k } + = {B | any relation satisfies.
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.
Movies length titleyearfilmType Voices isa Cartoons isa MurderMystery weapon toStar Our Movie Example.
Entity-Relationship Model
The Relational Data Model. Why Relational Model? Most of the current DBMS are based on the relational data model: –simplicity –mathematically based: expressions.
The principal problem that we encounter is redundancy, where a fact is repeated in more than one tuple. Most common cause: attempts to group into one relation.
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 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.
Conversion E/R to Relational CIS 4301 Lecture Notes Lecture 6 - 1/31/2006.
© D. Wong Ch. 2 Entity-Relationship Data Model (continue)  Data models  Entity-Relationship diagrams  Design Principles  Modeling of constraints.
Entity-Relationship Model
Data Modeling Translating E-R Diagrams to Relations
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.
© D. Wong Ch. 3 (continued)  Database design problems  Functional Dependency  Keys of relations  Decompositions based on Functional Dependency.
Dale Roberts 11/26/ Department of Computer and Information Science, School of Science, IUPUI Fall 2003 Dale Roberts, Lecturer Computer Science, IUPUI.
More Relation Operations 2015, Fall Pusan National University Ki-Joune Li.
Operations in the Relational Model COP 4720 Lecture 8 Lecture Notes.
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.
The Entity-Relationship Model CIS 4301 Lecture Notes 1/12/2006.
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.
Guofeng Cao CyberInfrastructure and Geospatial Information Laboratory Department of Geography National Center for Supercomputing Applications (NCSA) University.
1 Functional Dependencies 函数依赖 Meaning of FD’s Keys and Superkeys Functional Dependencies.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations Functional Dependencies.
CS 405G: Introduction to Database Systems Relations.
CPSC 603 Database Systems Lecturer: Laurie Webster II, M.S.S.E., M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 5 Introduction to a First Course in Database Systems.
Functional Dependencies. Babies Exercise 2.2.5: At a birth, there is one baby (twins would be represented by two births), one mother, any number of nurses,
© D. Wong Ch. 3 (part 1)  Relational Model basics  From E/R diagram to Relations.
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.
CS422 Principles of Database Systems From ER to Relations Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture notes.
Hele-Mai Haav: CSC210-Spring*01 CSC230-Spring*03 Database Design.
Introduction to Database Systems, CS420
Entity-Relationship Model
Cushing, Keller, UlmanJudy Cushing
CPSC-310 Database Systems
Instructor: Zhe He Department of Computer Science
CPSC-310 Database Systems
Transforming E/R to Relational Model.
Design Theory for Relational Databases
More Relation Operations
The Relational Data Model
CS 405G Introduction to Database Systems
CS 505: Intermediate Topics to Database Systems
CS 405G: Introduction to Database Systems
Design Theory for Relational Databases
Presentation transcript:

The Relational Data Model Database Model (E/R) Relational Schema Physical storage Diagrams (E/R) Tables: row names: attributes rows: tuples Complex file organization and index structures.

Terminology Title Year Length FilmType Star Wars color Mighty Ducks color Wayne’s World color tuples Attribute names components of tuples

More Terminology Every attribute has an atomic type. Relation Schema: relation name + attribute names + attribute types Relation instance: a set of tuples. Only one copy of any tuple! Database Schema: a set of relation schemas. Database instance: a relation instance for every relation in the schema.

From E/R Diagrams to Relations Entity sets become relations with the same set of attributes. Relationships become relations whose attributes are only: –The keys of the connected entity sets. –Attributes of the relationship itself.

Entity Sets to Relations titleyearlengthfilmtype Star Wars Color Might Ducks Color Wayne’s World199295Color Movies length filmType title year Relation schema: Movies(title, year, length, filmtype ) A relation instance:

E/R Relationships to Relations Relationships in the E/R model are also represented by relations. The relation for a given relationship R has the following attributes: –For each entity set involved in relationship, we take its key attribute(s) as part of the schema of the relation for R. –If the relationship has attributes, these are also attributes of relation R. When one entity set is involved several times in a relationship - or - the same attribute name appears in the keys of different ES participating in the relationship R, - or - even when we like to avoid confusion and to be clearer in meaning we should rename the attributes.

1.The relationship Owns between entity sets Movies and Studios is represented by a relation with schema: Owns(title,year,studioName). A sample instance is: titleyearstudioName Star Wars1977Fox Mighty Ducks1991Disney Example (with Renaming)

2.The relationship Stars-In between entity sets Movies and Stars is represented by a relation with schema: Stars-In(title, year, starName) 1.A sample instance is: title yearstarName Star Wars 1977Carrie Fisher Star Wars 1977Mark Hamill Star Wars 1977Harrison Ford Mighty Ducks 1991Emilio Estevez Wayne’s World 1992 Dana Carvey Wayne’s World 1992 Mike Meyers Example (with Renaming)

Likes(drinker, beer) Favorite(drinker, beer) Married(husband, wife) Buddies(name1, name2) LikesDrinkersBeers Favorite Married husband wife name addr name manf Buddies 1 2

Combining Relations It is OK to combine the relation for an entity-set E with the relation R for a many- one relationship from E to another entity set. Example: Drinkers(name, addr) and Favorite(drinker, beer) combine to make Drinker1(name, addr, favBeer).

Risk with Many-Many Relationships Combining Drinkers with Likes would be a mistake. Why? It leads to redundancy, as: name addr beer Sally 123 Maple Bud Sally 123 Maple Miller Redundancy

Handling Weak Entity Sets Relation 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. A supporting (double-diamond) relationship is redundant and yields no relation.

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