[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1469
  • Last Modified:

primary key vs unique index

I have 2 tables and i want to retrieve data from them and combine data to do some processing
I haven't made any column as PRIMARY yet ..

what is better to way do, shud i make col. as PRIMARY KEY in the tables separately or can i also make UNIQUE INDEX .. is unique index similar to making primary key ..




0
max_dub
Asked:
max_dub
  • 2
  • 2
1 Solution
 
max_dubAuthor Commented:
if i am not clear on question, please let me knw.. i am just getting to knw db's
0
 
dqmqCommented:
You always want a primary key; you get a unique index by default.  Primary key is a logical constraint that is implemented with a unique index.  The advantage of the primary key is that it does not allow nulls and it is referenceable by a foreign key constraint.  



 
0
 
dqmqCommented:
PS. There is no additional overhead for the PK, just benefit.  
0
 
max_dubAuthor Commented:
thanks
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now