You want to set a constraint so that the "item_id" in the "sales" table will always have a value that
already exists as "id" in the "item_master" table. Select the correct SQL statement to fill in the
underlined blank of the "sales" table. Definitions:
CREATE TABLE item_master (
id INTEGER PRIMARY KEY,
name TEXT
);
CREATE TABLE sales (
sales_id INTEGER,
item_id INTEGER,
num INTEGER,
);
- FOREIGN KEY (id) REFERENCES item_master (item_id)
- FOREIGN KEY (item_id) REFERENCES item_master (id)
- REFERENCES item_master (item_id)
- REFERENCES item_master (id)
- REFERENCES item_master (id) TO item_id
Reveal Solution
Next Question