Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Now, consider the following instances of the Customer and Reserves tables: (2

ID: 3738874 • Letter: 1

Question

1.   Now, consider the following instances of the Customer and Reserves tables: (20 Pts)

1)   Write the DDL code to build the above database. (8 Pts)

i.   Please determine the data type for each attribute by yourself.

ii.   Make sure you can set primary key and foreign key correctly.

iii.   Create table command only.

Customer Reserves CID Title CID.| Name | Age | City | State 1Joe 27BerkeleyCA 2 Betty 23Oakland CA 3 Sally 49Albany CA 4Hamy 38Berkeley CA 1 Sleeper Bananas 2 Sleeper Date 01/01/01 01/01/01 01/01/01 2Annie Hall 0201/01 2 Sleeper Interiors 4 Sleeper 02/01/01 02/01/01 03/01/01

Explanation / Answer

1) CREATE

CREATE TABLE Customer
(
CID INT PRIMARY KEY,
NAME VARCHAR(16),
AGE INT,
CITY VARCHAR(16),
STATE VARCHAR(10)
);

CREATE TABLE Reserves
(
CID int,
TITLE VARCHAR(16),
DATE DATETIME.
ADD FOREIGN KEY(CID) REFERNCES Customer(CID)
);

OR

ALTER

ALTER TABLE Reserves
ADD FOREIGN KEY(CID) REFERNCES Customer(CID)