Question: I have provided SQL code to create all tables and insert all data. There is an error in setting referential integrity: one of the tables

I have provided SQL code to create all tables and insert all data. There is an error in setting referential integrity: one of the tables is missing references. Read the code and identify the problem. You can either modify create table statement or add alter table statement to include missing references.1 Find missing foreign keys for one of the tables. You can either modify create table statement or add alter table statement to include missing references.

CREATE TABLE OrderDetails

(

OrderID NUMBER NOT NULL,

ProductID NUMBER NOT NULL,

UnitPrice NUMBER NOT NULL,

Quantity NUMBER NOT NULL,

Discount NUMBER NOT NULL,

CONSTRAINT PK_Order_Details

PRIMARY KEY (OrderID, ProductID),

CONSTRAINT CK_Discount CHECK ((Discount >= 0 and Discount <= 1)),

CONSTRAINT CK_Quantity CHECK ((Quantity > 0)),

CONSTRAINT CK_UnitPrice CHECK ((UnitPrice >= 0))

)

/

INSERT INTO OrderDetails (OrderID, ProductID, UnitPrice, Quantity, Discount)

VALUES (9901,4411, 33, 5, 0.11);

INSERT INTO OrderDetails (OrderID, ProductID, UnitPrice, Quantity, Discount)

VALUES (9901,4412, 50, 20, 0.05);

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!