What is primary key and foreign key in sql?

SQL

Could someone tell me what is primary key and foreign key in SQL?

2
Answers

Replies

Primary key: A primary key in SQL is used to make sure that the data in the specific column is unique. It is referred to as a column that should not contain the null values. It could be either in the existing table column or a column that is specifically generated based on the defined sequence.



Foreign Key: A foriegn key in SQL is referred to as a column or a group of columns that is used to provide a link between the two tables. It is the column that is referencing the other column (most often primary key) of another table.

 

Primary key: A primary key in SQL is used to make sure that the data in the specific column is unique. It is referred to as a column that should not contain the null values. It could be either in the existing table column or a column that is specifically generated based on the defined sequence.

 
 

If you want to unleash your potential in this competitive field, please visit the SQL course page for more information, where you can find the SQL tutorials and SQL frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.
Protected by Astra Security