What's the difference between a primary key and a unique
key?

Answers were Sorted based on User's Feedback



What's the difference between a primary key and a unique key?..

Answer / swapna

Both primary key and unique enforce uniqueness of the
column on which they are defined. But by default primary
key creates a clustered index on the column, where are
unique creates a nonclustered index by default. Another
major difference is that, primary key doesn't allow NULLs,
but unique key allows one NULL only.

Is This Answer Correct ?    16 Yes 0 No

What's the difference between a primary key and a unique key?..

Answer / ramneet

There is one more diff b/w primary key and unique key that
there is only one primary key in a table but there are more
then one unique keys in a table.

Is This Answer Correct ?    11 Yes 2 No

What's the difference between a primary key and a unique key?..

Answer / gowthami radhakrishnana

1)primary key uses clustered index
unique key uses non-clustered index

2)primary key doesn't allow null values
but unique allows one null value

3)there is only one primary key but more than one unique
keys

Is This Answer Correct ?    5 Yes 1 No

What's the difference between a primary key and a unique key?..

Answer / ramneet

Primary can be used in foregin key but unique key does not
used.

Is This Answer Correct ?    4 Yes 2 No

Post New Answer

More SQL Server Interview Questions

What does the INSTEAD OF trigger do?

3 Answers  


what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration

0 Answers  


What happens to a statement batch if there is a compilation error?

0 Answers  


We need to perform what steps in the following order to work with a cursor?

0 Answers  


How to insert new line characters into strings?

0 Answers  






What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.

0 Answers  


What is the stuff?

0 Answers  


What is Fragmentation and Defragmentation? For 32GB Table,How can we do the fragmentation?

1 Answers  


when u import an excel file into sql if suppose one column has got a date field with system time attached to it what data type u will use in sql to import it in a table? Note: a condition is the excel file has no primary key defined to a column...also u r importing bulk data into sql

1 Answers  


What is the difference between DataRow.Delete() and DataRow.Remove()?

0 Answers  


How to write character string constants or literals in ms sql server?

0 Answers  


What is a hint?

0 Answers  


Categories