8.1k views
4 votes
A foreign key is an attribute (or combination of attributes) whose value is unique across all occurrences of a relation.

User Fchancel
by
8.1k points

1 Answer

3 votes

Final answer:

A foreign key is an attribute that establishes a relationship between two tables in a database.

Step-by-step explanation:

A foreign key is an attribute (or combination of attributes) that references the primary key of another relation. It is used to establish a relationship between two tables in a database. The values of the foreign key must match the values of the primary key in the referenced table, ensuring referential integrity.

For example, consider a database with two tables: 'Students' and 'Courses'. The 'Courses' table has a primary key column called 'Course_ID'. The 'Students' table has a foreign key column called 'Course_ID' that references the primary key in the 'Courses' table. This allows us to relate the student to the course they are enrolled in.

User Tomer Gabel
by
8.8k points