Computer Science - Class 12
Solutions to CBSE Sample Paper - Computer Science Class 12

Define the term Foreign Key with respect to RDBMS. Explain how it is used to establish a relationship between two tables. Give one example to support your answer.

Answer:

Answer by student

A foreign key is an attribute or a set of attributes in a table that refers to the primary key of another table. It is used to establish a relationship between two tables by ensuring that the values in the foreign key column are valid and consistent with the values in the primary key column of the referenced table. 

For example, if there are two tables Student and Course, where Student has an attribute CourseID that refers to the primary key ID of Course, then CourseID is a foreign key in Student.

Detailed answer by teachoo

The rest of the post is locked. Join Teachoo Black to see the full post.

Go Ad-free
Davneet Singh's photo - Co-founder, Teachoo

Made by

Davneet Singh

Davneet Singh has done his B.Tech from Indian Institute of Technology, Kanpur. He has been teaching from the past 14 years. He provides courses for Maths, Science and Computer Science at Teachoo