Question:medium

Which of the following is correct syntax for inserting foreign key constraint in a relation?

Updated On: Jan 16, 2026
  • ALTER TABLE table_name ADD FOREIGN KEY(attribute_name) REFERENCES referenced_table_name(attribute_name)
  • ADD TABLE table_name ADD FOREIGN KEY(attribute_name) REFERENCES referenced_table_name(attribute_name)
  • ALTER TABLE table_name REFERENCES referenced_table_name(attribute_name) ADD FOREIGN KEY(attribute_name)
  • MODIFY TABLE table_name ADD FOREIGN KEY(attribute_name) REFERENCES referenced_table_name(attribute_name)
Show Solution

The Correct Option is A

Solution and Explanation

To establish a foreign key constraint in a relation, the syntax is: ALTER TABLE table_name ADD FOREIGN KEY(attribute_name) REFERENCES referenced_table_name(attribute_name). The ALTER TABLE statement modifies an existing table. The ADD FOREIGN KEY clause designates a column to link to a primary key in another table. The components of this syntax are:

  • ALTER TABLE table_name: Designates the table to be modified.
  • ADD FOREIGN KEY(attribute_name): Specifies the addition of a foreign key constraint to the designated column, attribute_name, in the current table.
  • REFERENCES referenced_table_name(attribute_name): Identifies the target table, referenced_table_name, and the specific column within that table, attribute_name, to which the foreign key will point.

Correct application of this syntax enforces referential integrity, ensuring consistent data relationships across tables.

Was this answer helpful?
0