what is foreign key
Answers
Answer:
In the context of relational databases, a foreign key is a set of attributes subject to a certain kind of inclusion dependency constraint, specifically a constraint that the tuples consisting of the foreign key attributes in one relation, R, must also exist in some other (not necessarily distinct) relation, S, and furthermore that those attributes must also be a candidate key in S.[1][2][3] In simpler words, a foreign key is a set of attributes that references a candidate key. For example, a table called TEAM may have an attribute, MEMBER_NAME, which is a foreign key referencing a candidate key, EMPLOYEE_NAME, in the EMPLOYEE table. Since MEMBER_NAME is a foreign key, any value existing as the name of a member in TEAM must also exist as an employee name in the EMPLOYEE table; in other words, every member of a TEAM is also an EMPLOYEE.