2 10 points Consider the following ER diagram and write down

2. (10 points) Consider the following ER diagram, and write down the SQL statements that create the tables, including the föreign key and primary key indications. cid Many to Many pid) Customers Orders Products

Solution

1. CREATE TABLE Customers( cid int NOT NULL, PRIMARY KEY (cid));

2. CREATE TABLE Productss( pid int NOT NULL, PRIMARY KEY (pid));

3. CREATE TABLE Orders ( oid int NOT NULL,cid int,pid int,PRIMARY KEY (oid),FOREIGN KEY (cid) REFERENCES Customers(cid),FOREIGN KEY (pid) REFERENCES Products(pid));

 2. (10 points) Consider the following ER diagram, and write down the SQL statements that create the tables, including the föreign key and primary key indicatio

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site