You are on page 1of 10

MIS 6326 (Database Management)

Assignment 2: Chapters 5 & 6


Please upload a correct and readable assignment file (e.g., a text file, a PDF file, or an MS Word file).
After uploading the assignment file, you MUST validate it by checking what you uploaded. If you
uploaded a wrong file, you can take it back and upload a correct one before the assignment due date. At
the time of grading, no credit will be given to a wrong assignment (e.g., an assignment file for a different
class) or an unreadable file.
Answer Chapter 6 Data Modeling Problems 1, 2, 3, 4, 5, and 6 (p. 197 of the textbook).
Answer Chapter 6 Conversion Problems 1, 5, 6, and 8 (pp. 212214 of the textbook). [Note: You do not
have to list conversion rules in your answer. Just convert ERDs into relational models] [Note: A relational
model is a collection of CREATE TABLE commands.]

DM-1.
Visio
Home
PK

homeid

FK1

street
city
state
zip
nobedms
nobaths
sqft
ownoccupied
ownerid

Owner
PK
owns

ownerid
ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

ER Assistant (Provided by the Textbook Author)


home
homeid
street
city
state
zip
nobedrms
nobaths
sqft
ownoccupied

owner

owns

ownerid
ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

Note: The Visio ERD shows foreign keys explicitly; but the ER-Assistant ERD does not show foreign
keys. Both ways of drawing ERDs are acceptable. But be sure to consistent: Do not mix these two
different methods.

Note: The Visio ERD method is currently more popular; most ERD tools use it. In the final exam, ERD
questions will require foreign keys shown explicitly. So, I strongly suggest you to use Visio or a
comparable tool.
DM-2.
Visio
Home
PK

homeid

FK1
FK2

street
city
state
zip
nobedms
nobaths
sqft
ownoccupied
ownerid
agentid

Owner
PK
owns

ownerid
ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

lists

Agent
PK

agentid
agentname
officeid
phone

ER Assistant (Provided by the Textbook Author)


home
homeid
street
city
state
zip
nobedrms
nobaths
sqft
ownoccupied
commission
salesprice

owner

owns

lists

agent
agentid
agentname
officeid
phone

ownerid
ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

DM-3.
Visio
Home
PK

homeid

FK1
FK2

street
city
state
zip
nobedms
nobaths
sqft
ownoccupied
ownerid
agentid

Owner
PK

ownerid
ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

owns

lists

Office
PK

Agent
PK

agentid

FK1

agentname
officeid
phone

worksat

officeid
address
mgrname
phone

ER Assistant (Provided by the Textbook Author)


home
homeid
street
city
state
zip
nobedrms
nobaths
sqft
ownoccupied
commission
salesprice

owner

owns

ownerid
ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

lists

agent
agentid
agentname
Phone
ssn

office
worksat

officeid
address
mgrname
phone

DM-4.
Visio
Home
PK

homeid

FK1
FK2

street
city
state
zip
nobedms
nobaths
sqft
ownoccupied
ownerid
agentid

PK

Office
PK

Agent
agentid

FK1

agentname
officeid
phone

worksat

ownerid

address
mgrname
phone

ER Assistant (Provided by the Textbook Author)


home
buyer
owner

owns

lists

ownerid
ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

workswith

agent
agentid
agentname
phone
ssn

buyerid

FK1

buyerSSN
buyername
buyeraddress
buyerphone
spousename
spouseSSN
bdrms
bthrms
minprice
maxprice
agentid

officeid

workswith

homeid
street
city
state
zip
nobedrms
nobaths
sqft
ownoccupied
commission
salesprice

PK

ownname
ownSSN
ownprofess
spousename
spouseprofess
spouseSSN

lists

PK

Buyer

Owner
owns

office
worksat

officeid
address
mgrname
phone

buyerid
buyerSSN
buyername
buyeraddress
spousename
spouseSSN
bdrms
bthrms
minprice
maxprice

DM-5.
Visio
Csutomer
PK

Home
PK

homeid

FK2
FK1

street
city
state
zip
nobedms
nobaths
sqft
ownoccupied
agentid
customerid

customerid
name
SSN
spousename
spouseSSN

Buyer

Owner

owns
PK,FK1

ownerid

PK,FK2

buyerid

FK1

buyerphone
bdrms
bthrms
minprice
maxprice
agentid

ownprofess
spouseprofess

lists
Office
PK

Agent
PK

agentid

FK1

agentname
officeid
phone

worksat

officeid
address
mgrname
phone
workswith

ER Assistant (Provided by the Textbook Author)


person
personid
SSN
name
phone
spousename
spouseSSN

D,C

home
homeid
street
city
state
zip
nobedrms
nobaths
sqft
ownoccupied
commission
salesprice

buyer
owner
owns

ownprofess
spouseprofess

lists
workswith
agent
agentid
agentname
phone
SSN

office
worksat

officeid
address
mgrname
phone

Note: D, C in the hierarchy is not needed.

buyeraddress
minprice
bdrms
bthrms
maxprice

DM-6.
Csutomer
PK

Home
PK

homeid

FK2
FK1

street
city
state
zip
nobedms
nobaths
sqft
ownoccupied
agentid
customerid

customerid
name
SSN
spousename
spouseSSN

Buyer

Owner

owns
PK,FK1

ownerid

PK,FK2

buyerid

FK1

buyerphone
bdrms
bthrms
minprice
maxprice
agentid

ownprofess
spouseprofess

Offer

lists
madefor

PK

offerno

FK1
FK2

price
submitdate
expdate
buyerid
homeid

Agent
PK

agentid

FK1

agentname
officeid
phone

workswith

Office

worksat
PK

officeid
address
mgrname
phone

Note: The Offer entity may have submittime and exptime attributes.

makes

offer

madefor

OfferNo
expdate
price
counteroffer
SubmitDate

person
ssn
name
phone

home

D,C

homeid
street
city
state
zip
nobedrms
nobaths
sqft
ownoccupied
commission
salesprice

makes
buyer
owner

owns

ssn
spousename
profession
spouseprofess

ssn
address
minprice
bdrms
bthrms
maxprice

workswith

lists
office
agent
agentid
agentname
phone

worksat

officeid
address
mgrname
phone

Note: There are some incorrect and missing attributes in the authors ERD.

Instead of the following short description, you may use the CREATE TABLE command.
Conv-1.
home(homeid, agentid, ssn, street, city, state, zip, nobedrms, nobaths,
sqft, ownoccupied, commission, salesprice)
PRIMARY KEY: homeid
FOREIGN KEY: agentid REFERENCES agent.agentid
FOREIGN KEY: ssn REFERENCES owner.ssn
agent(agentid, officeid, name, phone)
PRIMARY KEY: agentid
FOREIGN KEY: officeid REFERENCES office.officeid
owner(ssn, name, spousename, profess, spouseprofess)
PRIMARY KEY: ssn
office(officeid, mgrname, phone, address)
PRIMARY KEY: officeid

Conv-5.
account(acctid, acctname, balance, parent_acctid)
PRIMARY KEY: acctid
FOREIGN KEY: acctid REFERENCES account.acctid

Note: Instead of the above account table, one may have the following two tables.
account(acctid, acctname, balance)
PRIMARY KEY: acctid
decomposed(acctid, parent_acctid)
PRIMARY KEY: acctid, parent_acctid
FOREIGN KEY: acctid REFERENCES account.acctid
FOREIGN KEY: parent_acctid REFERENCES account.acctid
part(partno, partdesc, color)
PRIMARY KEY: partno
contains(super_partno, sub_partno)
PRIMARY KEY: super_partno, sub_partno
FOREIGN KEY: super_partno REFERENCES part.partno
FOREIGN KEY: sub_partno REFERENCES part.partno

Conv-6.
student(stdid, name, gender, dob, admitdate)
PRIMARY KEY: stdid
undstudent(stdid, major, minor, class)
PRIMARY KEY: stdid
FOREIGN KEY: stdid REFERENCES student.stdid
gradstudent(stdid, advisor, thesistitle, asststatus)
PRIMARY KEY: stdid
FOREIGN KEY: stdid REFERENCES student.stdid

Conv-8.
project(projno, projname)
PRIMARY KEY: projno
specialty(specno, specname)
PRIMARY KEY: specno
contractor(contrno, specno, contrname)
PRIMARY KEY: contrno
FOREIGN KEY: specno REFERENCES specialty.specno
projectneeds(projno, specno)
PRIMARY KEY: projno, specno
FOREIGN KEY: projno REFERENCES project.projno
FOREIGN KEY: specno REFERENCES specialty.specno
providedby(contrno, projno, specno)
PRIMARY KEY: contrno, projno, specno
FOREIGN KEY: (projno, specno) REFERENCES
projectneeds.(projno, specno)
FOREIGN KEY: contrno REFERENCES contractor.contrno

10

You might also like