Difference between primary key and unique key ?
Answers were Sorted based on User's Feedback
Answer / ranjeet kumar
There is only one primary key in a table but multiple unique
key.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / shakeel shikari
the difference is only primary key does not accept null values
while unique key accept null value
remember that unique key holds null only once
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ankit kumar singh
Primary Key:
* Primary Key can not contain null value
* Clustured index is created in Primary key.
* Primary Key allows Each row in a table to uniquely
identified and insures that no applicable row exists.
Unique Key:
* Unique Key can contain null value.
* More than one Unique key in a table can be declared.
* Non-clustered index is created in unique key.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / susil kumar rout
When we applied primary key constraint upon a column of a table internally oracle create a cluster index.In case of unique constraint,oracle create a non-cluster index.
In a table or entity one primary key and one or more than one
unique key can be applied.
We can't insert duplicate value or null value to primary key
column where as null value can insert into unique key column.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / nithin
1. There can be more than one unique key in a row or table
but there can be only one primary key in a row or table.
2. Primary key does not accept NULL values but Unique key
accepts even NULL values.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / arpit sachan
Primary key Accept only one Null Value...But a Unique key Accept one or More Null value........
create table #foo(id varchar(5)primary key,name varchar(10));
insert into #foo('','Your name');
---------->> see the result.....
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / omkar
In any table there can be one and only one primary key
(composite priamry key can have more than 1 column but
together conside one key only) but more than one unique
keys.
Primary key cannot accecpt null value.unique key accecpts
one or more than one null values.
primary key uniquly identifies the table but unique key is
used for uniquly identified of table as it contain one or
more than onee null.
Clustered index is created on
Primary key constraint and non clustered unique indexes is
created on Unique key constraint.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / madhusudan reddy paila
Primery Key is allows the null value but unique wont accept
the null values in database ....
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / dinesh
Primary Key:
It wont accept NULL values.
It wont accept Duplication.
Unique Key:
It accepts NULL values.
Foreign Key:
It accepts NULL values.
It accepts Duplication.
Main point is, A Foreign key denotes a Primary key in the another table.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / chandra bhan kumhar
1. Primary key accepts a value only single time not more then one time means it doesn't allow repetition same as for unique key.
2. Primary key don't allow null values ,but unique key allow null values.
Is This Answer Correct ? | 0 Yes | 0 No |
What are the uses of Database Trigger ?
How to handle a single quote in oracle sql?
What is the dynamic sql in oracle?
What are the different editions of oracle?
Tell me New Feature of Oracle 10g?
Hi Every One , What is the table Space in Oracle Database ? waiting for answere and thankyou
How to call a stored function in oracle?
What is an oracle data file?
What is a subquery?
What is a static data dictionary in oracle?
What are the types of synonyms?
does the query needs a hint to access a materialized view?