From E/R Diagrams to Relational Schema

Slides:



Advertisements
Similar presentations
Information Systems Chapter 4 Relational Databases Modelling.
Advertisements

Translating from ER to Relationship Schema Adapted from Juliana Freire.
1 Relational Model and Translating ER into Relational.
1 Lecture 04 Entity/Relationship Modelling. 2 Outline E/R model (Chapter 5) From E/R diagrams to relational schemas (Chapter 5) Constraints in SQL (Chapter.
Lecture #2 October 5 th, 2000 Conceptual Modeling Administration: –HW1 available –Details on projects –Exam date –XML comment.
Functional Dependencies Definition: If two tuples agree on the attributes A, A, … A 12n then they must also agree on the attributes B, B, … B 12m Formally:
1 Lecture 3: Database Modeling (continued) April 5, 2002.
Lecture 9: Conceptual Database Design January 27 th, 2003.
Multiplicity in E/R Diagrams
The Relational Data Model Database Model (ODL, E/R) Relational Schema Physical storage ODL definitions Diagrams (E/R) Tables: row names: attributes rows:
1 Lecture 4: Database Modeling (end) The Relational Data Model April 8, 2002.
E/R Diagrams and Functional Dependencies. Modeling Subclasses The world is inherently hierarchical. Some entities are special cases of others We need.
Lecture 08: E/R Diagrams and Functional Dependencies.
Lecture 2: E/R Diagrams and the Relational Model Thursday, January 4, 2001.
Conceptual Database Design. Building an Application with a DBMS Requirements modeling (conceptual, pictures) –Decide what entities should be part of the.
1 Introduction to Database Systems CSE 444 Lecture 07 E/R Diagrams October 10, 2007.
Lecture 2: E/R Diagrams and the Relational Model Wednesday, April 3 rd, 2002.
Lecture 3: Conceptual Database Design and Schema Design April 12 th, 2004.
1 Lecture 08: E/R Diagrams and Functional Dependencies Friday, January 21, 2005.
COMP 430 Intro. to Database Systems ER Implementation as Tables Slides use ideas from Chris Ré.
Modeling Constraints Extracting constraints is what modeling is all about. But how do we express them? Examples: Keys: social security number uniquely.
Lecture 4: The E/R Model Lecture 4 Today’s Lecture 1.E/R Basics: Entities & Relations ACTIVITY: Crayon time! 2.E/R Design considerations ACTIVITY: Crayon.
The Relational Data Model Database Model (ODL, E/R) Relational Schema Physical storage ODL definitions Diagrams (E/R) Tables: row names: attributes rows:
Introduction to Database Systems, CS420
ERwin.
Lecture 11: Functional Dependencies
Order Database – ER Diagram
Lecture 5: Conceptual Database Design
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
COP5725 Database Management ER DIAGRAM AND RELATIONAL DATA MODEL
BBM 471 – Database Management Systems
Database Design Oct. 3, 2001.
Database Design Why do we need it? Consider issues such as:
ER Diagram Practical Example
Lecture 4 Lecture 4: The E/R Model.
02: ER Model Ch 4.1 – 4.4 Optionally, begin with Ch 2.1.
Conceptual Database Design
Order Database – ER Diagram
بسم الله الرحمن الرحيم.
Cse 344 March 2nd – E/r diagrams.
Cse 344 May 14th – Entities.
Order Database – ER Diagram
Transformation of E/R Diagram to Relation
Lecture 4: Database Modeling (continued)
Cse 344 May 11th – Entities.
Entity – Relationship Model
Lecture 2: Database Modeling (end) The Relational Data Model
Lecture 06 Data Modeling: E/R Diagrams
Functional Dependencies and Relational Schema Design
Lecture 09: Functional Dependencies, Database Design
name category name price makes Company Product stockprice buys employs
Functional Dependencies
Lecture 8: Database Design
Lecture 8: The E/R Model I
Lecture 9: The E/R Model II
Functional Dependencies
Order Database – ER Diagram
Lecture 10: The E/R Model III
Lecture 5: The Relational Data Model
CSE544 Data Modeling, Conceptual Design
ER to Schema.
Functional Dependencies
Lecture 06: SQL Monday, October 11, 2004.
The Relational Data Model
Lecture 08: E/R Diagrams and Functional Dependencies
CS4222 Principles of Database System
Lecture 6: Functional Dependencies
Session 5: Weak Entity Sets and ER Model to Relational ( )
Presentation transcript:

From E/R Diagrams to Relational Schema Easier than ODL (using a liberal interpretation of the word “easy”) - relationships are already independent entities - only atomic types exist in the E/R model. Entity sets relations Relationships relations Special care for weak entity sets.

name category name price makes Company Product Stock price buys employs Person name ssn address

Entity Sets to Relations name category price Product Product: Name Category Price gizmo gadgets $19.99

Relationships to Relations Start Year name category name makes Company Product Stock price Relation MAKES (watch out for attribute name conflicts) Product-name Product-Category Company-name Starting-year gizmo gadgets gizmoWorks 1963

Handling Weak Entity Sets affiliation Team University sport number name Relation TEAM: Sport Number University-name mud wrestling 15 Montezuma State U. - need all the attributes that contribute to the key of Team - don’t need a separate relation for Affiliation.

Modeling Subclass Structure Product Platforms required memory ageGroup topic Educational Product Software Product Educ-software Product Educational-method

Option #1: the ODL Approach 4 tables: each object can only belong to a single class Product(name, price, category, manufacturer) EducationalProduct( name, price, category, manufacturer, ageGroup, topic) SoftwareProduct( name, price, category, manufacturer, platforms, requiredMemory) EducationalSoftwareProduct( name, price, category, manufacturer, ageGroup, topic, platforms,

Option #2: the E/R Approach Product(name, price, category, manufacturer) EducationalProduct( name, ageGroup, topic) SoftwareProduct( name, platforms, requiredMemory) No need for a relation EducationalSoftwareProduct Unless, it has a specialized attribute: EducationalSoftwareProduct(name, educational-method)

Option #3: The Null Value Approach Have one table: Product ( name, price, manufacturer, age-group, topic, platforms, required-memory, educational-method) Some values in the table will be NULL, meaning that the attribute not make sense for the specific product. How many more meanings will NULL have??