When should I use a primary key or an index?
What are their differences and which is the best?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Basically, a primary key is (at the implementation level) a special kind of index. Specifically:
UNIQUE– you cannot have more than one row with the same primary key, since its purpose is to uniquely identify rows.NULL, so the row(s) it consists of must be NOT NULLA table can have multiple indexes, and indexes are not necessarily
UNIQUE. Indexes exist for two reasons: