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

What is coalesce sql?

0 Answers  


what is mean by forward declaration and where we'll use it.

4 Answers   TCS,


What are the syntax and use of the coalesce function?

0 Answers  


How is a process of pl/sql compiled?

0 Answers  


How do you write an index?

0 Answers  






mail-id table contains two columns(email_id,userid) it contains different types of mail-ids,and no of users. here username length is differ na,(ex- tamil@yahoo.com,joshua@hotmail.com like) now i want to fetch the email-ids only starting from '@' (ex-@gmail.com,@yahoo.com,@hotmail.com

5 Answers  


What is normalization ?

9 Answers   BirlaSoft, CTS, HCL,


How well can multiple sessions access the same data simultaneously ?

1 Answers   Oracle,


What will you get by the cursor attribute sql%found?

0 Answers  


full outer join syntax

5 Answers  


explain advantages of innodb over myisam. : Sql dba

0 Answers  


i want count no of values in a column i.e enam eempno phoneno x 1 (98765,09887,096561,87964579,156678,678900876) that means if i select phone no from table i want to get total count of phone numbers i.e 6

8 Answers   Satyam,


Categories