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
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