+ 3

what is difference between unique and primary key?

31st Aug 2016, 5:01 AM
Akash Gupta
Akash Gupta - avatar
6 Antworten
+ 1
Unique key prevents duplicate values in a column, while primary key identifies the row.
31st Aug 2016, 5:09 AM
Roberto Sanchez
Roberto Sanchez - avatar
+ 1
A unique key is a unique constraint on a column, which allows one null value. It will also create a non clustered index. You can have multiple unique keys on different columns on the sane table. A primary key is the combination of unique constraint and a not null constraint, plus a clustered index. You can only have one primary key on a table. Typically it is the first column on a table, one that uniquely identifies the rest of the data in the row, like ID.
31st Aug 2016, 11:09 PM
Michael Skae
Michael Skae - avatar
0
Related with this question.... when you said, unique key prevents duplicate values in a column, what do you really means ? I will appreciate your answer. I just barely know about this programs, however, I am determine to learn.... Thank you...
31st Aug 2016, 5:24 AM
Eddy Top
Eddy Top - avatar
0
thank you guys
31st Aug 2016, 12:02 PM
Akash Gupta
Akash Gupta - avatar
0
Both guarantees the uniqueness in a column
2nd Sep 2016, 11:35 AM
Kutty Vijay3
Kutty Vijay3 - avatar
0
unique key is used for a field to not allow any duplication in that column... Primary key= unique key + not null
5th Sep 2016, 1:42 PM
Shiv