What is a primary key? Define foreign key? How does it play a role in the join operation?
Answers
Answer:
Primary key is a key which uniquely identifies each and every record in a table.
Foreign key refers to a primary key or a unique key in another table.
Explanation:
Answer:
In the relational model of databases, a primary key is a specific choice of a minimal set of attributes (columns) that uniquely specify a tuple (row) in a relation (table). Informally, a primary key is "which attributes identify a record", and in simple cases are simply a single attribute: a unique id.A foreign key is a column (or combination of columns) in a table whose values must match values of a column in some other table. FOREIGN KEY constraints enforce referential integrity, which essentially says that if column value A refers to column value B, then column value B must exist.It acts as a cross-reference between tables because it references the primary key of another table, thereby establishing a link between them. A JOIN is used when you extract/query data from the Database by giving rules how to select the data.