What's the difference between a primary key and a unique
key?
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
Answer / ramneet
Primary can be used in foregin key but unique key does not
used.
| Is This Answer Correct ? | 4 Yes | 2 No |
what is the maximum size of sql row in mssql?
Creating Tables Using SELECT
What should we do to copy the tables, schema and views from one SQL Server to another?
How can we delete Duplicate row in table?
Which tcp/ip port does sql server run on? How can it be changed?
Is it possible to have more then one foreign key in a single table? if possible, is this the good way to design the table?
Define DML and DCL statements?
what is checksum in sql server.........???
What is a function? Give some example?
What is a cursor in SQL Server 2000 and their types?
What is the security principal at the database level that represents your session?
How secure is sql server database?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)