SQL>
SQL> CREATE TABLE Recipe
(Quantity_used DECIMAL (2,1)
FOREIGN KEY "ICECREAM_ID"
REFERENCES icecreamGT(Icecream_id),
FOREIGN KEY (ingredient_id) REFERENCES ingredient (Ingredient_name),
);
2 3 4 5 6 FOREIGN KEY "ICECREAM_ID"
*
ERROR at line 3:
ORA-00907: missing right parenthesis
UPDATED: new code with adjusted commas and parenthesis
CREATE TABLE Recipe
(
Quantity_used DECIMAL (2,1),
FOREIGN KEY (ID_icecream)
REFERENCES icecreamGT(Icecream_id)
FOREIGN KEY (ID_ingredient)
REFERENCES ingredient(Ingredient_name)
);
CodePudding user response:
Your statement does not have:
- An
icecream_id
column in therecipe
table; - An
ingredient_id
column in therecipe
table; - Commas in the correct places;
()
Brackets around the"ICECREAM_ID"
identifier in the column list of the foreign key.
I.e.:
CREATE TABLE Recipe(
Quantity_used DECIMAL (2,1),
icecream_id NUMBER,
ingredient_id NUMBER,
FOREIGN KEY (ICECREAM_ID) REFERENCES icecreamGT(Icecream_id),
FOREIGN KEY (ingredient_id) REFERENCES ingredient (Ingredient_name)
);
db<>fiddle here