Difference between primary key and unique key ?
Answers were Sorted based on User's Feedback
Answer / anuradha
The unique column constraints permits multiple entries of
null in the column. these null values are clubbed at top of
column in order they were entered into table. this is
essential difference .
Table have more than 1 unique key which is not possible in
primary key
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / chauhan rakesh botad
Primary key doesnot allow null value but unique key allows
null value. We can declare only one primary key in a table
but a table can have multiple unique key(column assign).
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / pawan mishra
One table may have more than one Unique Key Constraint
columns, but should have only one Primary Key Constraint
column.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / ibrahim
PRIMARY KEY is identity of each row. UNIQUE KEY also
identity of each row.
PRIMARY KEY not accepts null values but unique can accept null.
but the core different between primary key and unique is we use primary key to link tow tables with each other but we can not use unique key to do this.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / pandiyan
Primary key doesnot allow null value but unique key allows
null value.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / chetan sharma
Primary key creates Clustered Index.
Unique key creates non-clustered Index.
the no of primary key in a table is one but the no of
unique is more then one
there is only one primary key for one table;
it can not acept null values;
any no uniquefor a table;
it can accept null values;
which the rows are unique value;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / lucky
Primary key not accepts to null values in database, but
uniqe key accepts to the null values in database.
Each table having only one PRIMARY KEY.And my contain many
UNIQUE KEYS.
PRIMARY KEY is identity of each row. UNIQUE KEY also
identity of each row.
BOTH keys will not contain repeated value.
BUT UNIQUE KEY will contain NULL value but PRIMAY key will
not contain NULL value.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / pramod paunikar
Both primary key and unique enforce uniqueness of the
column on which they are defined. But by default primary
key creates a clustered index on the column, where are
unique creates a non-clustered index by default. Another
major difference is that, primary key does not allow NULLs,
but unique key allows only one NULL only.
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / manoj routh
Both primary key and unique enforce uniqueness of the column
on which they are defined. But by default primary key
creates a clustered index on the column, where are unique
creates a nonclustered index by default. Another major
difference is that, primary key doesn't allow NULLs, but
unique key allows one NULL only.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / sikander
Primary key does not allow null value but unique key allows
null value. suppose tableA two column : columnB & columnC .
where coulmnB is primary key & columnC is unique key.
If we insert null value in columnB.It will not accept
columnB but columnC
Is This Answer Correct ? | 1 Yes | 0 No |
How to do clean up if create database failed?
What is concurrency in oracle?
What is the difference between count (*), count (expression), count (distinct expression)?
definition of cluster and non-clustered index?
What is the difference between RBBMS & DBMS?
What is Normalization ?
55 Answers ACS, Genpact, Graphix Solution, IBM, Keane India Ltd, TCS, Vault,
If I have a select statment which retrives 2 rows, & that rows have the same data in all the fields except the last field and I want to merge the 2 rows to be in 1 row with concatenating the last field which have the different data.... eg: the 1st row has these fields: A-B-C the second row has: A-B-X ........ i want to merge the two row to be in one row like ----> A- B- C,X
can you call insert/update/delete in select statements. If yes how? If no what is the other way?
How to transfer database(500 gb) of oracle enterprise edition to standard edition downtime is only 1 hour not using exp/imp option ?
What is ceil and floor in oracle?
normally database take to refresh time 2 hours. but client asked iwant to refresh with in 5 min that same database. do you have any option in BO and Oracle? explain me briefly...kavi
what is the syntax of DROP command?