CREATE TABLE purchase_order (order_number int(11) NOT NULL,order_name char(50) N
ID: 3889977 • Letter: C
Question
CREATE TABLE purchase_order (order_number int(11) NOT NULL,order_name char(50) NOT NULL,customer_address char(50),customer_zip int(5) DEFAULT NULL, customer_city char(50) DEFAULT NULL,order_total varchar(50)DEFAULT NULL,V_VendorID VARCHAR(20) DEFAULT NULL,ITEM_NUMBER int(10) NOT NULL,PRIMARY KEY (order_number),FOREIGN KEY FK_vendor (V_VendorID) REFERENCES vendor(V_VendorID),FOREIGN KEY FK_inventory(ITEM_NUMBER) REFERENCES Inventory(I_FlowerNumber),CONSTRAINT FK_inventory FOREIGN KEY (ITEM_NUMBER) REFERENCES Inventory (I_FlowerNumber),CONSTRAINT FK_vendor FOREIGN KEY (V_VendorID) REFERENCES Vendor (V_VendorID));
I cant get this code to work? I am getting the error message ORA-00907: missing right parenthesis
Explanation / Answer
I checked this query in my PC by dividing in parts. They were no errors in the part which does not contain the Foreign key part. But when I am including the foreign key part it was raising errors. So the errors are in the foreign key part.Considering the foreign key part which is this.
FOREIGN KEY FK_vendor (V_VendorID) REFERENCES vendor(V_VendorID),
FOREIGN KEY FK_inventory(ITEM_NUMBER) REFERENCES Inventory(I_FlowerNumber),
CONSTRAINT FK_inventory FOREIGN KEY (ITEM_NUMBER) REFERENCES Inventory (I_FlowerNumber),
CONSTRAINT FK_vendor FOREIGN KEY (V_VendorID) REFERENCES Vendor (V_VendorID)
Here I found that the both the pairs are same and so removing first two bold lines will solve the problem. Try it and comment again to know the output:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.