What is primary key and forein key in sql???? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is primary key and forein key in sql????

29th Jan 2018, 5:03 AM
jaslin
jaslin - avatar
2 Answers
+ 17
primary key constraint 1)no duplicate values 2)no null values foreign key : its a non-key attribute which derives its value from primary key of another table its used when we want to connect tables through common fields & field connecting tables should have primary key to maintain referencial integrity
29th Jan 2018, 5:42 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
0
Primary key is the unique identifier of that record of that table. The foreign key is the unique identifier of a different table that the record references or links to.
25th Apr 2018, 8:07 PM
Woody