what is difference between "Primary key" and "Unique key"?

Answers were Sorted based on User's Feedback



what is difference between "Primary key" and "Unique key"?..

Answer / swapna

1)unique key can be null but primariy key cant be null.
2)primariy key can be refrenced to other table as FK.
Primary key and unique are Entity integrity constraints
Primary key allows each row in a table to be uniquely
identified and ensures that no duplicate rows
exist and no null values are entered.
Unique key constraint is used to prevent the duplication of
key values within the rows of a table and allow null
values. (In oracle, one null is not equal to another null).

Is This Answer Correct ?    4 Yes 0 No

what is difference between "Primary key" and "Unique key"?..

Answer / satya_k21

Hi,

Primary Key: Not Null+ unique.but it wont allows null
values.

Unique: It allows null values , but it should be unique.

Regards,
Satya.k

Is This Answer Correct ?    3 Yes 0 No

what is difference between "Primary key" and "Unique key"?..

Answer / nitin gupta

Uniques: Enforce unique data in the database
it allows row containing null value but only once
It implements non clustered index.

primary key: Enforce unique data in the database
it don't allow any record containing null value
it implements clustered index (data physically
sorted)

Is This Answer Correct ?    3 Yes 0 No

what is difference between "Primary key" and "Unique key"?..

Answer / kk

PRIMARY KEY=UNIQUE KEY+ NOT NULL KEY so its a combo drive

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More SQL PLSQL Interview Questions

Write a query to get 2nd maximum salary in an employee table ?

69 Answers   Accenture, BirlaSoft, Letse, Logica CMG, Qwest, Rheal Software, Saagam, Semantic Space, Tailor Solution, TCS, TinyERP,


diff b/w sub query and co-relater query?

3 Answers   iFlex,


What found sql?

0 Answers  


What is sql scripting?

0 Answers  


Whis is not false in primary key?

0 Answers   Fintellix,






What is the difference between delete and truncate statement in sql?

0 Answers  


How can I create a table from another table without copying any values from the old table?

8 Answers  


What is the difference between left join and right join?

0 Answers  


How to convert lowercase letters to uppercase and uppercase letters to lowercase in a string. (ex, AbcdEfG should convert as aBCDeFg)

3 Answers   TCS,


What is a database link?

3 Answers  


what is the difference between truncate and drop statements? : Sql dba

0 Answers  


What is the difference between clustered and non-clustered indexes?

0 Answers  


Categories