Primary Key vs Foreign Key

A primary key is used to ensure data in the specific column is unique. It is a column cannot have NULL values. It is either an existing table column or a column that is specifically generated by the database according to a defined sequence. A foreign key is a column or group of columns in a relational database table that provides a link between data in two tables. It is a column (or columns) that references a column (most often the primary key) of another table.

Posted September 9, 2022 by Rohith and Anusha ‐ 1 min read

quick-references blog primary-key foreign-key differences

Subscribe For More Content