Chapter 5 The Relational Data Model By Yue Lu CS157B Spring 2008 Instructor: Dr.Lee.

Slides:



Advertisements
Similar presentations
Chapter 3 : Relational Model
Advertisements

Database Lecture Notes Mapping ER Diagrams to Tables 2 Dr. Meg Murray
ER to Relational Translation COMSATS INSTITUTE OF INFORMATION TECHNOLOGY, VEHARI.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Basic (Flat) Relational Model.
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
© 2005 by Prentice Hall Chapter 3a Database Design Modern Systems Analysis and Design Fourth Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich.
Modeling Data The Entity Relationship Model (ER) For Database Design.
Chapter 3: Relational Model
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Representing Information. Data Models A data model is a precise description of information content Types of data models Conceptual (high-level): in terms.
Chapter 12 Representing Data Elements By Yue Lu CS257 Spring 2008 Instructor: Dr.Lin.
CHAPTER 2: MODELING DATA IN THE ORGANIZATION © 2013 Pearson Education, Inc. Publishing as Prentice Hall 1 Modern Database Management 11 th Edition Jeffrey.
© 2007 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 8 th Edition Jeffrey A. Hoffer, Mary B.
Copyright © 2003 Addison-Wesley Your name here. Copyright © 2003 Addison-Wesley Representing Information with Data Models What is a data model? How does.
©Silberschatz, Korth and Sudarshan2.1Database System Concepts Reduction of an E-R Schema to Tables A database which conforms to an E-R diagram can be represented.
Amity School of Engineering & Technology E-R Diagram for a University Enterprise.
1 Relational model concepts Key constraints Referential integrity constraint Steen Jensen, autumn 2013.
Module Title? DBMS E-R Model to Relational Model.
Relational Model Session 6 Course Name: Database System Year : 2012.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3 The Relational Data Model and Relational Database Constraints.
Module Title? Data Base Design 30/6/2007 Entity Relationship Diagrams (ERDs)
THE RELATIONAL DATA MODEL CHAPTER 3 (6/E) CHAPTER 5 (5/E) 1.
Chapter 3: Relational Model I Structure of Relational Databases Structure of Relational Databases Convert a ER Design to a Relational Database Convert.
CS 3630 Database Design and Implementation. 2 Mathematical Relation A mathematical relation is a subset of a Cartesian Product. A1  A2  A3  …  An.
10/9/20151 The Relational Data Model TCU Database Systems Last update: September 2004 Reference: Elmasri 4 th edition, chapter 5.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 2 Adapted from Silberschatz, et al. CHECK SLIDE 16.
Chapter 3: Relational Model  Structure of Relational Databases  Normal forms (chap. 7)  Reduction of an E-R Schema to Relational (Sect. 2.9)  Relational.
ICOM 5016 – Introduction to Database Systems Lecture 5b Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
1 Mathematical Relation A mathematical relation is a subset of a Cartesian Product. A1  A2  A3  …  An = {(x1, x2, x3, …, xn): xi  Ai} R  A1  A2.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall, modified by Dr. Lyn Mathis 5-1 David M. Kroenke’s, 10 th ed. Chapter.
Relational Database. Database Management System (DBMS)
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com ICOM 5016 – Introduction.
IE 423 – Design of Decision Support Systems Data modeling and database development.
Copyright © 2003 Addison-Wesley Sree Nilakanta. Copyright © 2003 Addison-Wesley Developing Relational Models What is the relational model and what is.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Access Review. Access Access is a database application A database is a collection of records and files organized for a particular purpose Access supports.
ICOM 5016 – Introduction to Database Systems Lecture 9 Dr. Manuel Rodriguez Department of Electrical and Computer Engineering University of Puerto Rico,
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Relational Theory and Design
Chapter 2 Introduction to Relational Model. Example of a Relation attributes (or columns) tuples (or rows) Introduction to Relational Model 2.
Chapter 2: Intro to Relational Model. 2.2 Example of a Relation attributes (or columns) tuples (or rows)
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Introduction.
CSE314 Database Systems Lecture 3 The Relational Data Model and Relational Database Constraints Doç. Dr. Mehmet Göktürk src: Elmasri & Navanthe 6E Pearson.
Database Systems – ER Diagrams EXAMPLE COMPANY DATABASE Requirements of the Company (oversimplified to illustrate) The company is organized into DEPARTMENTs.
1 DATABASE TECHNOLOGIES (Part 2) BUS Abdou Illia, Fall 2015 (September 9, 2015)
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
Jennifer Widom Relational Databases The Relational Model.
1 6 Concepts of Database Management, 5 th Edition, Pratt & Adamski Chapter 6 Database Design 2: Design Methodology Spring 2006.
Concepts of Database Management Seventh Edition Chapter 4 Keys and Relationship.
IE 423 – Design of Decision Support Systems Data modeling and database development.
Chapter 2: Entity-Relationship Model. 3.2 Chapter 2: Entity-Relationship Model Design Process Modeling Constraints E-R Diagram Design Issues Weak Entity.
©Silberschatz, Korth and Sudarshan7.1Database System Concepts - 6 th Edition Chapter 7: Entity-Relationship Model.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Lecture 4: Logical Database Design and the Relational Model 1.
Chapter 3 The Relational Model. Objectives u Terminology of relational model. u How tables are used to represent data. u Connection between mathematical.
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Database System Concepts, 6 th Ed. ©Silberschatz, Korth and Sudarshan See for conditions on re-usewww.db-book.com Chapter 2: Intro to Relational.
Chapter 71 The Relational Data Model, Relational Constraints & The Relational Algebra.
Database, tables and normal forms
Chapter 2: Intro to Relational Model
Chapter 3: Intro to Relational Model
Chapter 2: Intro to Relational Model
Relational Model.
DBMS ER-Relational Mapping
Chapter 2: Intro to Relational Model
Presentation transcript:

Chapter 5 The Relational Data Model By Yue Lu CS157B Spring 2008 Instructor: Dr.Lee

Relational Model Concepts The Relational Model of Data is based on the concept of a Relation The Relational Model of Data is based on the concept of a Relation A Relation is a two-dimensional table A Relation is a two-dimensional table –The columns of the table represent attributes –The rows of the table represent entities

Relational Model Concepts A relation schema is the name and the list of attributes of a relation A relation schema is the name and the list of attributes of a relation –Grade (studentId, assignmentId, points, dateSubmitted) A tuple is a row of a table, one value for each attribute A tuple is a row of a table, one value for each attribute –(101, 102, 92, 2/28/08)

Model Concepts Domain D is a set of atomic values Domain D is a set of atomic values –Atomic means that each value is indivisible Attribute A is the name of a role played by some domain Attribute A is the name of a role played by some domain Relation schema R is the specification of a relation Relation schema R is the specification of a relation –Given by a name and list of attributes –Degree of a relation is the number of attributes Relation (instance) r(R) of a relation schema Relation (instance) r(R) of a relation schema –A set of n-tuples, n is degree of relation schema

Characteristics of Relational Model Relation is a set of tuples Relation is a set of tuples –No ordering of tuples –No duplicate tuples no two rows have all the same values no two rows have all the same values Each attribute value is atomic Each attribute value is atomic –So no multiple-valued or composite attributes –called first normal form Each relation is a set of assertions Each relation is a set of assertions –Each represents a fact –Some facts are about relationships

Representing E-R Model as Relations Entity class  Relation schema Entity class  Relation schema Entity  row of table Entity  row of table –set of all entities of class  table Attribute  column definition (attribute) Attribute  column definition (attribute) –attribute value  table element Relationship type  Relationship type  –relation schema –attribute(s) of relation schema

Example of Relation Schema and Table Figure 4.2 P75 Figure 4.2 P75 –Customer(accountID,lastName,firstName, street, city, state, zipcode, balance) account Id lastNa me firstNa me streetcitystat e zipcod e balan ce 101BlockJane1010 Main St. Apopk a FL Hamilt on Cherry3230 Dade St. Dade City FL Harriso n Kate103 Dodd Hall Apopk a FL BreauxCarroll76 Main St. Apopk a FL

Attributes are atomic Composite attributes – –simple attribute for each field – –Customer (accountId, lastName, firstName, street, city, state, zipcode) Multi-valued Attributes –Represent as Tables – –See Figure 4.3

Attributes are atomic (cont.) All other attributes values are duplicated except OtherUser All other attributes values are duplicated except OtherUser The key of the schema is the set {accountId, OtherUser} The key of the schema is the set {accountId, OtherUser} account ID lastNam e firstNam e streetcitystatezipcode OtherUs er 104BreauxCarroll 76 Main St. ApopkaFL30458 Judy Breaux 104BreauxCarroll 76 Main St. ApopkaFL30458 Cyrus Lambea ux 104BreauxCarroll 76 Main St. ApopkaFL30458 Jean Deaux

Representing Relationships as Attributes One-to-many One-to-many –For each one-to-many relationship type R subject class S (one side) subject class S (one side) target class T (many side) target class T (many side) –Add the key attributes of S to the schema of T as foreign keys as foreign keys –Name the foreign key attributes ues the role that S plays in relationship type R ues the role that S plays in relationship type R –Add the attributes of the relationship type R to schema for T One-to-one One-to-one –choose one side and use above rule

Representing Relationships as Tables Create a relation schema for the relationship type Create a relation schema for the relationship type –foreign key attributes for the key of the related schema –add attributes of the relationship type

Many-to-many Relationship Types Schema: IsChildOf (child, parent) P80 Schema: IsChildOf (child, parent) P80 childparent

References Principles of Database Systems with Internet and Java Applications by Greg Riccardi Principles of Database Systems with Internet and Java Applications by Greg Riccardi Fundamentals of Database Systems by Elmasri Navathe Fundamentals of Database Systems by Elmasri Navathe Database Systems The Complete Book by Hector Garcia- Molina, Jeffrey D.Ullman and Jennifer Widom Database Systems The Complete Book by Hector Garcia- Molina, Jeffrey D.Ullman and Jennifer Widom