What Is Primary Key?
A Primary key frequently emphasises the table’s oneness. Every row in the database is uniquely linked by a column or group of columns. It shouldn’t contain any duplicate values, according to this. also, it does not have a NULL value.
What Is Foreign Key?
Typically, a foreign key is utilised to establish a connection between the two tables. To maintain data integrity between two different instances of an object, the foreign key’s primary function is to be
|SR.No||Primary Key||Foreign Key|
|1||A Primary key often emphasises the table’s uniqueness. It guarantees that the value in that particular column is distinct.||Typically, a foreign key is utilised to establish a connection between the two tables.|
|2||Table allows only one primary key.||Tables support multiple foreign keys.|
|3||The primary key doesn’t allow null values.||Foreign key accepts multiple null values.|
|4||It is capable of uniquely identifying the record in the database table.||A field in a table that serves as the main key in another table is known as a foreign key.|
|5||The value in the primary key cannot be deleted from the parent table.||This allows for the deletion of the value from the child table.|
|6||The temporary tables can be used to specify its restriction totally.||It is not possible to define its restriction on either the global or local temporary tables.|