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 are the authentication modes in sql server? How can it be changed? : Sql dba

0 Answers  


What are the benefits of pl sql?

0 Answers  


What is difference between ms sql and mysql?

0 Answers  


how to remove records from table? no name 1 a 2 b 1 a 2 b 3 c

8 Answers   Oracle,


How we get all_group_function's(Sum,avg,count,max and min_value of a column(Sal) Using pl/sql anonymous block, with out using group function's. You shouldn't use more than one select statement in entire the program. Like cursor c is select * from <table_name>; except this you can't use another select statement. You can use no of variables as per requirement.

1 Answers  






HOW TO TUNE ORACLE SQL QUERIES GIVE ME STEP BY SREP

1 Answers   TCS,


What is a scalar value in sql?

0 Answers  


how to enter binary numbers in sql statements? : Sql dba

0 Answers  


What are the types of records?

0 Answers  


What is trigger with example?

0 Answers  


How many database objects (trigger, packages, sequence etc) uses a particular field in a given table. For ex: I want to know how many database object uses the ATTRIBUTE1 in the PO_VENDORS table. What query will give me the result showing the database object name(package, trigger etc), field_name used (in this case ATTRIBUTE1) and table_name (in this case PO_VENDORS).

2 Answers   IBM,


what is difference between procedure and function, procedure and trigger?

8 Answers   iFlex,


Categories