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 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.