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 sql server means?
What is a virtual table in sql?
How do you check the performance of a query and how do you optimize it?
How will you collect the date from current date to last older 6 days date in sql server 2005
What are different types of collation sensitivity?
Please give me queries for the following 1. To get the count of duplicate records. 2. A query to delete the duplicate records.
What is BCP? When does it used in sql server 2012?
0 Answers TryTechnicals Pvt Ltd,
What is the difference between Stored Procedure , Function and Package, 1. how many blocks in Package and what are they.
List down some advantages of sql stored procedure?
What is a database in ms sql server?
How to get a list of columns in a view using the "sp_columns" stored procedure?
How to Insert multiple rows with a single insert statement?
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)