Question: Given the tables have been created without foreign keys added, which of the following ALTER TABLE statements would create a foreign key on the category

Given the tables have been created without foreign keys added, which of the following ALTER TABLE statements would create a foreign key on the category_id in the product table to reference the category_id in the category table?
a.)
ALTER TABLE category
ADD CONSTRAINT fk_product
FOREIGN KEY (category_id)
REFERENCES product (category_id);
b.)
ALTER TABLE product
ADD CONSTRAINT fk_product
FOREIGN KEY (category_id)
REFERENCES category (category_id);
c.)
ALTER TABLE product
ADD CONSTRAINT
FOREIGN KEY (category_id)
REFERENCES category (category_id);
d.)
ALTER TABLE product
ADD CONSTRAINT fk_product
FOREIGN KEY category (category_id)
REFERENCES category_id;

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!