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.

Slides:



Advertisements
Similar presentations
CS 405G: Introduction to Database Systems Instructor: Jinze Liu Fall 2009.
Advertisements

Database Management Systems Chapter 3 The Relational Data Model (I) Instructor: Li Ma Department of Computer Science Texas Southern University, Houston.
1–1 Students Entity/Relationship Model Diagrams to represent designs. Entity like object, = “thing.” Entity set like class = set of “similar” entities/objects.
CSCI 305 – Fall 2013 The Entity-Relationship Model Based on Slides by Prof. Brian King.
Winter 2002Arthur Keller – CS 1806–1 Schedule Today: Jan. 22 (T) u SQL Queries. u Read Sections Assignment 2 due. Jan. 24 (TH) u Subqueries, Grouping.
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.
1 Relational Model and Translating ER into Relational.
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.
ER to Relational Mapping Strong Entity Relation: ssno name salary employee Employee(ssno name salary) Key : ssno.
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.
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.
CS411 Database Systems Kazuhiro Minami
What is a Database Management System? 1. Manages very large amounts of data. 2. Supports efficient access to very large amounts of data. 3. Supports concurrent.
1 The Relational Data Model Tables Schemas Conversion from E/R to Relations.
CSCE 520- Relational Data Model Lecture 2. Relational Data Model The following slides are reused by the permission of the author, J. Ullman, from the.
Constraints on Relations Foreign Keys Local and Global Constraints Triggers Following lecture slides are modified from Jeff Ullman’s slides
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.
Relational Databases CPSC 315 – Programming Studio Spring 2013 Project 1, Lecture 2 Slides adapted from those used by Jeffrey Ullman, via Jennifer Welch.
Computational Biology Dr. Jens Allmer Lecture Slides Week 6.
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
Databases 1 Second lecture.
Dale Roberts 11/26/ Department of Computer and Information Science, School of Science, IUPUI Fall 2003 Dale Roberts, Lecturer Computer Science, IUPUI.
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.
CSCE 520- Relational Data Model Lecture 2. Oracle login Login from the linux lab or ssh to one of the linux servers using your cse username and password.
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.
Dale Roberts 1 Department of Computer and Information Science, School of Science, IUPUI Dale Roberts, Lecturer Computer Science, IUPUI
1 Introduction to SQL Database Systems. 2 Why SQL? SQL is a very-high-level language, in which the programmer is able to avoid specifying a lot of data-manipulation.
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.
603 Database Systems Senior Lecturer: Laurie Webster II, M.S.S.E.,M.S.E.E., M.S.BME, Ph.D., P.E. Lecture 18 A First Course in Database Systems.
© D. Wong Ch. 3 (part 1)  Relational Model basics  From E/R diagram to Relations.
Computational Biology Dr. Jens Allmer Lecture Slides Week 5.
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.
CS422 Principles of Database Systems Entity-Relationship Model Chengyu Sun California State University, Los Angeles Adapted from Jeffrey Ullman’s lecture.
Introduction to Database Systems, CS420
Entity-Relationship Model
COP4710 Database Systems Relational Model.
Cushing, Keller, UlmanJudy Cushing
CPSC-310 Database Systems
Instructor: Zhe He Department of Computer Science
Database Models Relational Model
CPSC-310 Database Systems
CPSC-310 Database Systems
Transformation of E/R Diagram to Relation
The Relational Data Model
Functional Dependencies
CS 405G Introduction to Database Systems
CS 505: Intermediate Topics to Database Systems
Instructor: Zhe He Department of Computer Science
CS 405G: Introduction to Database Systems
Presentation transcript:

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 you to added to the CS mailing list  Send all course related questions there for timely response (unless privacy needed)

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

3 A Relation is a Table namemanf WinterbrewPete’s Bud LiteAnheuser-Busch Beers Attributes (column headers) Tuples (rows)

4 Schemas Relation schema = relation name and attribute list.  Optionally: types of attributes.  Example: Beers(name, manf) or Beers(name: string, manf: string) Database = collection of relations. Database schema = set of all relation schemas in the database.

5 Why Relations? Very simple model. Often matches how we think about data. Abstract model that underlies SQL, the most important database language today.

6 From E/R Diagrams to Relations Entity set -> relation.  Attributes -> attributes. Relationships -> relations whose attributes are only:  The keys of the connected entity sets.  Attributes of the relationship itself.

7 Entity Set -> Relation Relation: Beers(name, manf) Beers name manf

8 Relationship -> Relation DrinkersBeers Likes Likes(drinker, beer) Favorite Favorite(drinker, beer) Married husband wife Married(husband, wife) name addr name manf Buddies 1 2 Buddies(name1, name2)

9 Combining Relations OK to combine into one relation: 1.The relation for an entity-set E 2.The relations for many-one relationships from E (“many”) to F Example: Drinkers(name, addr) and Favorite(drinker, beer) combine to make Drinker1(name, addr, favBeer).

10 Combining Relations (II) The combined relation schema consists of  All attributes of E  The key attributes of F  Any attributes belonging to the relationship R Can we combine one-one relationship? What about many-many?

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

12 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 relationship is redundant and yields no relation.

13 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 What if “At” has some attributes ?

14 Case Study cities counties states Popu. name Located Co. Popu. Co. name capitals Ci. Popu. Ci. name Belongs-to

15 Sample Solution States (name, popu) Conuties (co name, state name, co popu) Cities (ci name, co name, state name, ci popu) Capitals (state name, ci name, co name)

16 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:  Key attribute(s).  Attributes of that subclass.

17 Example Beers Ales isa name manf color

18 Object-Oriented namemanf BudAnheuser-Busch Beers name manfcolor Summerbrew Pete’sdark Ales Good for queries like “find the color of ales made by Pete’s.”

19 E/R Style namemanf Bud Anheuser-Busch Summerbrew Pete’s Beers name color Summerbrew dark Ales Good for queries like “find all beers (including ales) made by Pete’s.”

20 Using Nulls namemanf color Bud Anheuser-Busch NULL Summerbrew Pete’s dark Beers Saves space unless there are lots of attributes that are usually NULL.

21 Isa staff faculty student assistant Case Study employee ssn o salar y name position rank Percentage Time

22 Relations: employee(ssno, name, salary) staff(ssno, name, salary,position) faculty(ssno, name, salary, rank) studentassistant(ssno, name, salary, percentagetime) Key: ssno for all the relations Isa staff faculty Student assistant employee ssn o salar y name position rank Time percentage Subclass – Object-oriented

23 Relations: employee(ssno, name, salary) staff(ssno, position) faculty(ssno, rank) studentassistant(ssno, percentage_time) Key: ssno for all relations Isa staff faculty student assistant Subclass – E/R Style employee ssn o salar y name position rank Percentage Time

24 Isa staff faculty Student assistant employee ssn o salar y name position rank Percentage Time Relation: employee(ssno, name, salary, position, rank, percentage-time) Key : ssno as key Note: Sometimes we add an attribute “jobType” to make queries easier. Subclass – null value