Difference between primary key and unique key ?

Answers were Sorted based on User's Feedback



Difference between primary key and unique key ?..

Answer / umapathy.r

The column holding the primary key constraint cannot accept
null values.whereas colum holding the unique constraint can
accept null values assume that t3 is a table with two
columns t1 having primary key constraint and t2 having
unique constraint if u try to insert null into t2 it will
accept that values whereas column t1 will not accept null

Is This Answer Correct ?    1164 Yes 121 No

Difference between primary key and unique key ?..

Answer / niranjan dhungia

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 ?    1017 Yes 126 No

Difference between primary key and unique key ?..

Answer / satya

Primery Key = (Unique key - NULL values)

One table may have more than one Unique Key Constraint
columns, but should have only one Primary Key Constraint
column.

Any comment? please shoot a mail.

Is This Answer Correct ?    329 Yes 90 No

Difference between primary key and unique key ?..

Answer / prashant t.

First difference is that primary key doesn't accept null
values whereas unique accepts one or multiple.
second difference is that Clustered index is created on
Primary key constraint and non clustered unique indexes is
created on Unique key constraint.

Is This Answer Correct ?    320 Yes 94 No

Difference between primary key and unique key ?..

Answer / austin johnson

we can't insert a NULL value into to coloumn holding
primary key constrain.
where as we can insert a NULL value to a unique key feild.
Remember, both keys are used to identify the
rows/tuple/entry of the table uniquely.
so, only once u can enter a NULL value into the unique key
feild.

Is This Answer Correct ?    146 Yes 57 No

Difference between primary key and unique key ?..

Answer / hemendra singh chaudhary

In the Table a primary key constraint column cannot holding
the null values.whereas unique constraint colum can holding
the null values.
Ex.|--------------------|
| ID(P) | Name(U) | #ID(P) ->It's a Primary Key
|--------------------| * Its a Not Null
| 1 | Hemendra | * A table Contain 1 Primary
| 2 | Neeraj | Key.
| 3 | PremJe | #Name(U)->It's a Unique Key
|NotNull |canbe Null| * Its can contain Null Value
|--------------------| * A table Contain more
than 1 unique Key.

Please Check the Radio Button..........
******************Gud Luck********************

Is This Answer Correct ?    45 Yes 0 No

Difference between primary key and unique key ?..

Answer / anil singh

Primary key not accepts to null values in database, but
uniqe key accepts to the null values in database.

Is This Answer Correct ?    77 Yes 35 No

Difference between primary key and unique key ?..

Answer / sunil upadhyay

the basic difference is that primary key can not have null
value whereas Unique key can have null values.two null
value are not same.One table may have more than one Unique
Key Constraint
columns, but should have only one Primary Key Constraint
column.

Is This Answer Correct ?    88 Yes 51 No

Difference between primary key and unique key ?..

Answer / jeyasree

* Only one primary key is allowed per table (any number of
unique keys are allowed).
* Primary key columns automatically become NOT NULL (unique
keys can contain nulls).
* UNIQUE and DISTINCT are synonymous in a SELECT list.

Is This Answer Correct ?    82 Yes 45 No

Difference between primary key and unique key ?..

Answer / ark chowdary

7. Primary Key doesnt allow the Null Values. where as in
Unique accept the Null values.
One table may have more than one Unique Key Constraint.
But it sholud have only one Primary Key Constraint column.

Is This Answer Correct ?    77 Yes 47 No

Post New Answer

More Oracle General Interview Questions

Define oracle database

0 Answers  


What is control file used for?

0 Answers  


What is archive log in Oracle?

0 Answers   MCN Solutions,


Explain the difference between sap and oracle?

0 Answers  


How to invoke the data pump export utility?

0 Answers  


How to restrict the duplicate records in table valuesets

2 Answers   IBM,


In my table i have 4 columns with 100 records but in that 4 columns one column contains all NULL values so can i add NOT NULL CONSTRAINT on that column......... ok if it is not possible, can i add NOT NULL CONSTRAINT from 101 Record Onwards?

4 Answers   Cap Gemini,


How to convert the date format from dd/mm/yyyy to mm/dd/yyyy. (for eg). 22/05/2008 to 05/22/2008. when u use to_char(), it tells the month is invalid. how to resolve this problem.tel with eg.

2 Answers   AppLabs,


Explain what are the different type of segments?

0 Answers  


Please explain joins in oracle?

0 Answers  


Explain a data segment?

0 Answers  


16. Display the order number, order line number and the shipping date. If the shipping date is null, display the string <not shipped yet>.

1 Answers   Wipro,


Categories
  • Oracle General Interview Questions Oracle General (1808)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)