Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Draw Entity-Relationship Diagram for these tables. Put the diagram in a file and upload it. CREATE TABLE vendor ( vendorid CHAR(2) NOT NULL, vendorcountry CHAR(3)
Draw Entity-Relationship Diagram for these tables. Put the diagram in a file and upload it.
CREATE TABLE vendor ( | |
vendorid CHAR(2) NOT NULL, | |
vendorcountry CHAR(3) NOT NULL, | |
vendorname VARCHAR(25) NOT NULL, | |
PRIMARY KEY (vendorid, vendorcountry) | |
); | |
CREATE TABLE category ( | |
categoryid CHAR(2) NOT NULL, | |
categoryname VARCHAR(25) NOT NULL, | |
PRIMARY KEY (categoryid) | |
); | |
CREATE TABLE product ( | |
productid CHAR(3) NOT NULL, | |
productname VARCHAR(25) NOT NULL, | |
productprice NUMERIC (7,2) NOT NULL, | |
vendorid CHAR(2) NOT NULL, | |
vendorcountry CHAR(3) NOT NULL, | |
categoryid CHAR(2) NOT NULL, | |
PRIMARY KEY (productid), | |
FOREIGN KEY (vendorid, vendorcountry) REFERENCES vendor (vendorid, vendorcountry), | |
FOREIGN KEY (categoryid) REFERENCES | |
category(categoryid) | |
); | |
CREATE TABLE region ( | |
regionid CHAR NOT NULL, | |
regionname VARCHAR(25) NOT NULL, | |
PRIMARY KEY (regionid) | |
); | |
CREATE TABLE store ( | |
storeid VARCHAR(3) NOT NULL, | |
storezip CHAR(5) NOT NULL, | |
regionid CHAR NOT NULL, | |
PRIMARY KEY (storeid), | |
FOREIGN KEY (regionid) REFERENCES region(regionid) | |
); | |
CREATE TABLE customer ( | |
customerid CHAR(7) NOT NULL, | |
customername VARCHAR(15) NOT NULL, | |
customerzip CHAR(5) NOT NULL, | |
referredby CHAR(7), | |
PRIMARY KEY (customerid) | |
); | |
CREATE TABLE salestransaction ( | |
tid VARCHAR(8) NOT NULL, | |
customerid CHAR(7) NOT NULL, | |
storeid VARCHAR(3) NOT NULL, | |
tdate DATE NOT NULL, | |
PRIMARY KEY (tid), | |
FOREIGN KEY (customerid) REFERENCES customer(customerid), | |
FOREIGN KEY (storeid) REFERENCES store(storeid) | |
); | |
CREATE TABLE soldvia ( | |
productid CHAR(3) NOT NULL, | |
tid VARCHAR(8) NOT NULL, | |
noofitems INT NOT NULL, | |
PRIMARY KEY (productid, tid), | |
FOREIGN KEY (productid) REFERENCES product(productid), | |
FOREIGN KEY (tid) REFERENCES salestransaction(tid) | |
); |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started