Presentation is loading. Please wait.

Presentation is loading. Please wait.

From E/R Diagrams to Relational Schema

Similar presentations


Presentation on theme: "From E/R Diagrams to Relational Schema"— Presentation transcript:

1 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.

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

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

4 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

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

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

7 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,

8 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)

9 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??


Download ppt "From E/R Diagrams to Relational Schema"

Similar presentations


Ads by Google