Question: Single-select QuestionImagine you have the database (relational schema) shown below with 5 tables, a table for Department, a table for Employee and a table for

Single-select QuestionImagine you have the database (relational schema) shown below with 5 tables, a table for Department, a table for Employee and a table for Customer. Salesman is a type of Employee. Subscription is a service that a Customer can pay for.

department (dptno CHAR(3), dptname CHAR(20), dptphone CHAR(15))

employee (eid CHAR(4), name CHAR(20), joindate DATE, dptnoFK CHAR(3))

customer (cid CHAR(6), cname VARCHAR(20), email VARCHAR(30), acquired INTEGER, dptnoFK CHAR(3), salesmanidFK CHAR(4))

subscription (subid CHAR(3), subname VARCHAR(20), desc VARCHAR(100))

subcustomer (cidFK CHAR(6), subidFK CHAR(3), startdate DATE)

Which one is the correct SQL code to create the table customer:

A.

CREATE TABLE customer (cid CHAR(6), cname VARCHAR(20) NOT NULL, email VARCHAR(30) NOT NULL, acquired INTEGER NOT NULL, dptno CHAR(3), salesmenid CHAR(4), PRIMARY KEY (cid), FOREIGN KEY (dptno) REFERENCES department(dptno) ON UPDATE CASCADE, FOREIGN KEY(eid) REFERENCES employee (eid) ON UPDATE CASCADE);

B.

CREATE TABLE customer (cid CHAR(6) NOT NULL UNIQUE, cname VARCHAR(20) NOT NULL, email VARCHAR(30) NOT NULL, acquired INTEGER NOT NULL, dptno CHAR(3), salesmenid CHAR(4), PRIMARY KEY (cid), FOREIGN KEY (dptno) REFERENCES department(dptno) ON UPDATE CASCADE, FOREIGN KEY(salesmenid) REFERENCES employee (eid) ON UPDATE CASCADE);

C.

CREATE TABLE customer (cid CHAR(6) NOT NULL UNIQUE, cname INTEGER NOT NULL, email VARCHAR(30) NOT NULL, acquired INTEGER NOT NULL, dptno CHAR(3), salesmenid CHAR(4), PRIMARY KEY (cid), FOREIGN KEY (dptno) REFERENCES department(dptno) ON UPDATE CASCADE, FOREIGN KEY(salesmenid) REFERENCES employee (eid) ON UPDATE CASCADE);

D.

CREATE TABLE customer (cid CHAR(6) NOT NULL UNIQUE, cname VARCHAR(20) NOT NULL, email VARCHAR(30) NOT NULL, acquired INTEGER NOT NULL, dptno CHAR(3), salesmenid CHAR(4), PRIMARY KEY (cid), FOREIGN KEY (dptno) REFERENCES department(dptno) ON UPDATE CASCADE;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!