Question: In the following SQL statements, some tables are created with different constraints. Give one primary key constraint and one foreign key constraint and specify
In the following SQL statements, some tables are created with different constraints. Give one primary key constraint and one foreign key constraint and specify in which table each is given? CREATE TABLE Customer_T (CustomerID CustomerName CustomerAddress Customer City Customer State CREATE TABLE Order T (OrderID Order Date CustomerID CustomerPostalCode CONSTRAINT Customer_PK PRIMARY KEY (CustomerID)); NUMBER(11,0) NOT NULL. VARCHAR2(25) NOT NULL. VARCHAR2(30), VARCHAR2(20), CREATE TABLE Product T (ProductID Product Description ProductFinish Product Standard Price CHAR(2), VARCHAR2(9), CREATE TABLE OrderLine_T (OrderID ProductID NUMBER(11,0) DATE DEFAULT SYSDATE, NUMBER(11,0). CONSTRAINT Order_PK PRIMARY KEY (OrderID), CONSTRAINT Order_FK FOREIGN KEY (CustomerID) REFERENCES Customer_T (CustomerID)); NOT NULL, NUMBER(11,0) VARCHAR2(50), VARCHAR2(20), DECIMAL (6,2), NUMBER(11,0), ProductLineID CONSTRAINT Product PK PRIMARY KEY (ProductID)); NOT NULL, NUMBER(11,0) NUMBER(11,0) NUMBER(11,0), OrderedQuantity CONSTRAINT OrderLine PK PRIMARY KEY (OrderID, ProductID), CONSTRAINT OrderLine FK1 FOREIGN KEY (OrderID) REFERENCES Order_T (OrderID), CONSTRAINT OrderLine FK2 FOREIGN KEY (ProductID) REFERENCES Product_T (ProductID)); NOT NULL, NOT NULL,
Step by Step Solution
There are 3 Steps involved in it
Answer The primary key constraint CustomerPK is ... View full answer
Get step-by-step solutions from verified subject matter experts
