+ 1
When creating a table why we use PRIMARY KEY. what is the reault
PRIMARY KEY
3 Answers
+ 13
Hello !!!
While creating any database table using SQL, primary key is important.
Primary Key cannot contain null values and must contain unique values.
Suppose you create a table Student_Info and the columns are RollNo, Name, Age and Marks. Now this database table is used to store records of all students, so the field RollNo for all students is the main attribute from which we identify the students in the table uniquely, as two or more students can have same name, same age and same marks. But no two or more students can have same Roll Numbers.
So RollNo field should be unique(different) and should be Not Null(Not Empty). and the RollNo is made the Primary Key. So primary key is basically used to identify your table uniquely.
Hope This Helps !!!
+ 7
Primary key uniquely identifies each row in your table .
https://www.sololearn.com/discuss/184541/?ref=app
+ 7
https://www.sololearn.com/learn/SQL/1849/?ref=app