0
What is the difference between primary key and super key?
5 Answers
+ 4
Primary Key:Â Primary key is the columns you choose to maintain uniqueness of each colume in a table. Like EmployeeID or student roll number can be use as primary key. Here student roll number is unique for a particular class. No two student can have same roll no in same class. As employeeID for a company is unique.
4. Super Key: If you add any other column/attribute to a Primary Key then it become a super key, like EmployeeID + FullName is a Super Key. And if there is more than one class data is stored on same table, then to make uniqueness of colume then you can use class id + student roll no. And this is called a super key.
Hope you understand, for more comment
+ 3
Think about a student table having name, roll number, age,class_id.
student{
int roll_number , age, class_id;
VARCHAR name;
primary key (roll_number, class_id)
}
And this code description is given in my pervious example.
Remember this code is not that valid because syntax error. But to create a primary key is correct. You can use it.
0
I need a good example for super key
0
ty aditya
0
Minimal column which are sufficient to identify row is primary key. Super keyalso use for identify row but one super key may be contain more than 1 primary key or combination of primary keys known as super key. Both used for uniquely identify of row. Table contain more than 1 candidate key but only 1 primary key.