Professional Documents
Culture Documents
Relational Schema
Excerpt from
Chapter 3, “Database Management Systems” 3ed, R. Ramakrishnan and J. Gehrke
according to the
key constraint on Employees Manages Departments
Manages.
Translation to
relational model?
Works_In
since
1/30/2008 USC - CSCI585 - Spring 2008 - Farnoush Banaei-Kashani 6
Participation Constraints in SQL
We can capture participation constraints involving
one entity set in a binary relationship
name
cost pname age
ssn lot
Better design
Policies
policyid cost
1/30/2008 USC - CSCI585 - Spring 2008 - Farnoush Banaei-Kashani 10
Binary vs. Ternary Relationships (Contd.)
CREATE TABLE Policies (
The key policyid INTEGER,
constraints allow cost REAL,
us to combine ssn CHAR(11) NOT NULL,
Purchaser with PRIMARY KEY (policyid).
Policies and FOREIGN KEY (ssn) REFERENCES Employees,
Beneficiary with ON DELETE CASCADE)
Dependents.
CREATE TABLE Dependents (
Participation pname CHAR(20),
constraints lead to age INTEGER,
NOT NULL
policyid INTEGER,
constraints. PRIMARY KEY (pname, policyid).
FOREIGN KEY (policyid) REFERENCES Policies,
ON DELETE CASCADE)
1/30/2008 USC - CSCI585 - Spring 2008 - Farnoush Banaei-Kashani 11
Extended ER (EER)
Excerpt from
Chapters 2 & 3, “Database Management Systems” 3ed, R. Ramakrishnan and J. Gehrke
Specialization/Generalization Employees
entity.
Overlap constraints: Can Joe be an Hourly_Emps as well as a
Contract_Emps entity? (Disjoint/Overlapping)
Covering constraints: Does every Employees entity also have to be an
Hourly_Emps or a Contract_Emps entity? (Total/Partial)
Reasons for using ISA:
To add descriptive attributes specific to a subclass.
To identify entities that participate in a relationship.