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

Do you know how to send email from database?

0 Answers  


What is a print index?

0 Answers  


What will be the maximum number of index per table?

0 Answers  


Without Using Cursors , How to Select the Selected row??

3 Answers   CarrizalSoft Technologies, Wipro,


you added a row to a view, but the row is not shown on the view. Explain how this can happen, and how you can remedy the situation

0 Answers  






How can you append an identity column to a temporary table?

0 Answers  


Do you know what is user defined datatypes and when you should go for them?

0 Answers  


What is the difference between a Local temporary table and a Global temporary table? How is each one used?

2 Answers   HCL,


Would it be a good idea to create an index on a table that always contains 10 records? Why or why not?

3 Answers  


What is the difference between lock, block and deadlock? : sql server database administration

0 Answers  


what is the disadvantage of SQL Loder?

1 Answers   TCS,


What are the different ways of moving data/databases between servers and databases in SQL Server?

1 Answers  


Categories