Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

What are some global issues confronting women?

Answered: 1 week ago

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago

Question

=+What is the most that you should pay to complete development?

Answered: 1 week ago