Hi,
Can somebody explain me the difference between primary key
and unique key and in which scenarios we use them. please
explain with a example.
Regards
ChipThe primary distinction is that Primary key column(s) must be non-nullable
while Unique constraints allow a NULL value. Also, there can be only one
primary key in a table while there can be more than one Unique constraints
defined for a table.
--
Anith|||Hi,
Primary key :
- The key which will not allow any NULL Values.
- Will Create a Clustered Index by default.
Unique Key
- The Key will allow 1 Null Value
- Will Create a non clustered index by default
Since Primary key will not allow NULLS values it can be used in scenario to
preserve more data integrity
Thanks
Hari
MCDBA
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:12c4c01c3f6a9$9ac762d0$a401280a@.phx.gbl...
> Hi,
> Can somebody explain me the difference between primary key
> and unique key and in which scenarios we use them. please
> explain with a example.
> Regards
> Chipsql
Showing posts with label scenarios. Show all posts
Showing posts with label scenarios. Show all posts
Tuesday, March 27, 2012
Difference Between primary key and unique key
Hi,
Can somebody explain me the difference between primary key
and unique key and in which scenarios we use them. please
explain with a example.
Regards
ChipThe primary distinction is that Primary key column(s) must be non-nullable
while Unique constraints allow a NULL value. Also, there can be only one
primary key in a table while there can be more than one Unique constraints
defined for a table.
Anith|||Hi,
Primary key :
- The key which will not allow any NULL Values.
- Will Create a Clustered Index by default.
Unique Key
- The Key will allow 1 Null Value
- Will Create a non clustered index by default
Since Primary key will not allow NULLS values it can be used in scenario to
preserve more data integrity
Thanks
Hari
MCDBA
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:12c4c01c3f6a9$9ac762d0$a401280a@.phx
.gbl...
> Hi,
> Can somebody explain me the difference between primary key
> and unique key and in which scenarios we use them. please
> explain with a example.
> Regards
> Chip
Can somebody explain me the difference between primary key
and unique key and in which scenarios we use them. please
explain with a example.
Regards
ChipThe primary distinction is that Primary key column(s) must be non-nullable
while Unique constraints allow a NULL value. Also, there can be only one
primary key in a table while there can be more than one Unique constraints
defined for a table.
Anith|||Hi,
Primary key :
- The key which will not allow any NULL Values.
- Will Create a Clustered Index by default.
Unique Key
- The Key will allow 1 Null Value
- Will Create a non clustered index by default
Since Primary key will not allow NULLS values it can be used in scenario to
preserve more data integrity
Thanks
Hari
MCDBA
"Chip" <anonymous@.discussions.microsoft.com> wrote in message
news:12c4c01c3f6a9$9ac762d0$a401280a@.phx
.gbl...
> Hi,
> Can somebody explain me the difference between primary key
> and unique key and in which scenarios we use them. please
> explain with a example.
> Regards
> Chip
Subscribe to:
Posts (Atom)