what is a primary key and a foreingn key,? State similarities and diffey between them.
Answers
Primary key is special relational database table column designated to uniquely identify table records. It is an existing table column or column that is specifically generated by database according to defined sequence.
Foreign key is group of columns in relational database table that provides link between data in two tables.
Acts as cross-reference between tables because it references primary key of another table thereby establishing link between them.
Similarity between both keys is the one-to-one relationship where foreign key and primary key of linked table are same.
Difference between Primary Key and Foreign Key :
Primary key uniquely identify a record in the table.
Foreign key is a field in the table that is primary key in another table.