4
E-R to Relational - Basic Strong entity Table with all attributes of that entity • Relationships Table with primary keys of participating entities Weak entity Table with primary key of strong entity Multi-valued Attribute X Table with X, primary key of strong entity Row per value of X Finally ..

E-R to Relational - Basic Strong entity –Table with all attributes of that entity Relationships –Table with primary keys of participating entities Weak

Embed Size (px)

Citation preview

Page 1: E-R to Relational - Basic Strong entity –Table with all attributes of that entity Relationships –Table with primary keys of participating entities Weak

E-R to Relational - Basic

• Strong entity– Table with all attributes of that entity

• Relationships– Table with primary keys of participating entities

• Weak entity– Table with primary key of strong entity

• Multi-valued Attribute X– Table with X, primary key of strong entity– Row per value of X

• Finally ..

Page 2: E-R to Relational - Basic Strong entity –Table with all attributes of that entity Relationships –Table with primary keys of participating entities Weak

E-R to Relational - Improved

• For N-1/1-1 relationships– Move relationship attributes to the N-side entity’s table

• Dept id moves to employee.

• No need for a table for the relationship relating a weak entity– Remove the “depends” table

Page 3: E-R to Relational - Basic Strong entity –Table with all attributes of that entity Relationships –Table with primary keys of participating entities Weak

Emp-Dept ER Diagram

employee

department

dependentcar

Nameaddress

street

Start date

SSN

Dept id name

city

stateLic#

color

name reln

city

Supervises

Manages

Owns Supports

supervisor superviseeWorks for

phones

Page 4: E-R to Relational - Basic Strong entity –Table with all attributes of that entity Relationships –Table with primary keys of participating entities Weak

Emp-Dept schema

• Employee(SSN, name, street, city, deptid, startdate, supervisor_ssn)

• Dept(deptid, name, city, Manager-SSN)

• Phone(SSN, phone#)

• Dependent(EMP-SSN, Name, relation)

• Car(state, license#, color)

• CarOwners(owner-SSN, car-state, license#)