What is a primary key ?

Recall your school days, you have many students in your class. The teacher used to take attendance every morning. You remember if the teacher took attendance by roll number or student name ? The teacher always takes the attendance using the roll numbers and not names. Why ? Because in a class more than one student can have the same name but all students will have different roll numbers. This is very important to be able to identify each and every student uniquely in a class.


Definition of a primary key


A primary key is a column in a table that helps to identify a record uniquely.
All other columns in the table can have duplicate values, but not the primary key column. Therefore it is extremely important to add a primary key to your table. Otherwise when you do the update and delete operations you might update or delete the wrong record.


Tip : Just add an Id column to your table and mark it as your primary key. Then you will not have to worry about deciding which column to use as the primary key column

Related Questions

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp