Difference between primary key and unique key ?

Answers were Sorted based on User's Feedback



Difference between primary key and unique key ?..

Answer / vaithianathan

primary key not accepts null value and
not allows duplicate values.
but Unique key not allows duplicate values
but it accepts ONLY ONE NULL VALUE.

only one primary key allowed per table
we can create multiple unique keys
on the table

By Default, Primary key creates Clustered Index and Unique key Creates Non Clustered Index

Is This Answer Correct ?    3 Yes 0 No

Difference between primary key and unique key ?..

Answer / vijay

Primary key's main role is to make field as unique and
relates to other sub table. Whereas unique is role only to
keep unique value in that field.

Is This Answer Correct ?    4 Yes 2 No

Difference between primary key and unique key ?..

Answer / sripathi venkata ramesh

I am Sripathi Venkata Ramesh from Gudivada and the answer
is mentioned below

Primary key: A Primary key is a column or group of columns
used to uniquely identify each row in a table like
It defines the column as a Mandatory column.
The data held across the column must be unique.
By default it creates clustered index.
It does not allow null values and duplicate values


Unique key: It also for the record uniqueness.
It allows only one null value
By default it creates non clustered index

Is This Answer Correct ?    3 Yes 1 No

Difference between primary key and unique key ?..

Answer / avesh upadhyay,iims

are yar
primary key that does not accept null value
and in table only one exist.
but the case of uniue key that accept null value one or more
and many unique key exist in a single table

Is This Answer Correct ?    4 Yes 2 No

Difference between primary key and unique key ?..

Answer / boomiraj.p

Primary key: Do not allow the
duplicates and null values.
Unique key : Do not accept the
duplicates,but allow null value

Is This Answer Correct ?    2 Yes 0 No

Difference between primary key and unique key ?..

Answer / saga

--->We Define only one PK per table but it should have one
or more UK.
--->PK does not contain null but UK contains null.

Is This Answer Correct ?    2 Yes 0 No

Difference between primary key and unique key ?..

Answer / laxman k

1) Primary key can not accept null values, but unique can
accept null values.

2) only one primary key have in a table but max 249 unique
in a table

Is This Answer Correct ?    2 Yes 0 No

Difference between primary key and unique key ?..

Answer / bhushan tatar

column having primary key constraint should not contain
null values.

column having unique key constraint can contain null values.


Unique as well as primary key constraint can be
defined/applyed on more than one column.
EX.
ADD constraint uc_person UNIQUE(P_Id,Lastname)
ADD constraint uc_person PRIMARY KEY(P_Id,Lastname)

But whle creating table we can write unique key word
multiple time and primary key wprd only once.Because table
can have only one primary key and can have miltiple unique
key.But both can apply on more than one column.
and

Is This Answer Correct ?    10 Yes 9 No

Difference between primary key and unique key ?..

Answer / sandhya

Primary Key cannot contain null values
Each table has one and only one Primary Key
Primary Key is used to reference as Foreign key while
performing table joins
Clustered index is created on Primary Key

Unique Key can contain null value
A table can have any numberof unique keys
Non-clustered index is created on unique key columns

Is This Answer Correct ?    2 Yes 1 No

Difference between primary key and unique key ?..

Answer / deen dayal sharma

1. PRIMARY KEY & UNIQUE KEY both uniquely identity of each
row in a table.
2. BOTH keys will not contain repeated value.
3. One table may have more than one Unique Key Constraint But
it should have only one Primary Key Constraint column.
4. BUT UNIQUE KEY will contain NULL value but PRIMAY key will
not contain NULL value.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More Oracle General Interview Questions

hey friends, What are the steps I can do to transfer the database from Microsoft Access 2003 to oracle10g (or SQL) Best regards

0 Answers  


What is a nested table?

0 Answers  


What is the difference between the Oracle ODBC driver and a Microsoft ODBC (Open Database Connectivity) Driver?

0 Answers   CGI,


what is the difference between rollback & commit? can a foreign key has null value?

6 Answers  


what is the scenario where you take the database to NoArchivelog mode?

0 Answers  






1. Display all the rows and columns in the CLIENT table. Sort by client name in reverse alphabetical order.

2 Answers   Wipro,


What is primefaces used for?

0 Answers  


What are steps required to ENTER DATA INTO DWH?

2 Answers  


Her departmandaki isçilerden empno' su ikinci sirada olan isçilerin empno, deptno, hiredate, sira_no bigilerini döndüren sorguyu yaziniz?

0 Answers  


is there a tool to trace queries, like profiler for sql server?

0 Answers  


The table has 3 columns 4 rows. The output is which column has least null values( A COL SHOULD BE THE OUTPUT) Write the query plz. A B C ================ 1 NULL 2 NULL 3 4 NULL 5 6 7 NULL NULL O/P C = 2 4 6

2 Answers   TCS,


Can group functions be used in the order by clause in oracle?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1789)
  • 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)