+ 1

what is differnce between unique and primary key?

21st Sep 2016, 6:19 AM
Ashish Khadye
Ashish Khadye - avatar
5 Réponses
+ 3
Unique just means that the values of the column have to be all different. A primary key is unique, can't be null, and you can only have one per table.
21st Sep 2016, 7:37 AM
Zen
Zen - avatar
+ 3
unique key :- it ensures that no two rows have same value. primary key :-it accept that only one column can be applied. These doesn't allows null values.
21st Sep 2016, 11:29 AM
neha
neha - avatar
+ 1
Using unique or primary key works better when you have two or more tables and needs reference to the other table
21st Sep 2016, 8:12 AM
Joshua Ng andwe
Joshua Ng andwe - avatar
+ 1
Unique ensures that every value of a given column has to be different . A primary key ensures uniqueness as well but unlike Unique constraint, you can only one primary key in a table. Primary key is also different from Unique in that it enforces relationships to other tables of a database.
23rd Sep 2016, 1:41 PM
Philimon Wanja
Philimon Wanja - avatar
0
unique key ensures every column has to be different and allow null value. primary key does same work except it can't have null Value.
4th Nov 2016, 4:49 AM
manoj
manoj - avatar