Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on sql within the Database General forums, part of the Databases category; What is the difference between primary key and a unique key?...
|
|||||||
|
|||
|
Re: sql
Primary Key:
1. When created, an index gets created for the same. 2. Cannot hold NULL values 3. No duplicates allowed Unique key 1. When created, index gets created for unique key also 2. Can hold NULL values. 3. no duplicates allowed |
|
|||
|
Re: sql
hai,
The column holding the primary key constraint cannot accept null values.whereas column holding the unique constraint can accept null values assume that t3 is a table with two columns t1 having primary key constraint and t2 having unique constraint if u try to insert null into t2 it will accept that values whereas column t1 will not accept null Regards, Nithya.R |
|
|||
|
Re: sql
Hi,
Primary key doesnot allow null value but unique key allows null value. We can declare only one primary key in a table but a table can have multiple unique key(column assign). Thanks &Regards, Riju |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|