Data Mgmt Lab_Part_9 - 25 The Relational Model Answer 3.17...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
The Relational Model 25 Answer 3.17 The statements to create tables corresponding to entity sets Doctor, Pharmacy, and Pharm co are straightforward and omitted. The other required tables can be created as follows: 1. CREATE TABLE Pri Phy Patient ( ssn CHAR(11) , name CHAR(20) , age INTEGER , address CHAR(20) , phy ssn CHAR(11) , PRIMARY KEY (ssn), FOREIGN KEY (phy ssn) REFERENCES Doctor ) 2. CREATE TABLE Prescription ( ssn CHAR(11) , phy ssn CHAR(11) , date CHAR(11) , quantity INTEGER , trade name CHAR(20) , pharm id CHAR(11) , PRIMARY KEY (ssn, phy ssn), FOREIGN KEY (ssn) REFERENCES Patient, FOREIGN KEY (phy ssn) REFERENCES Doctor, FOREIGN KEY (trade name, pharm id) References Make Drug) 3. CREATE TABLE Make Drug (trade name CHAR(20) , pharm id CHAR(11) , PRIMARY KEY (trade name, pharm id), FOREIGN KEY (trade name) REFERENCES Drug, FOREIGN KEY (pharm id) REFERENCES Pharm co) 4. CREATE TABLE Sell ( price INTEGER , name CHAR(10) , trade name CHAR(10) , PRIMARY KEY (name, trade name), FOREIGN KEY
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/17/2012 for the course EGN 4302 taught by Professor Dr.vishak during the Fall '12 term at University of Central Florida.

Page1 / 3

Data Mgmt Lab_Part_9 - 25 The Relational Model Answer 3.17...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online