Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
khufiamalik
Posting Yak Master
120 Posts |
Posted - 2008-09-22 : 05:35:41
|
| Can any one tell me the difference between PK and Indexes.and Secondly , Does the DB automatically creates Indexes on PK?Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-22 : 05:48:39
|
| PK or primary key is the column/columns that uniquely defines a row in a table (i.e whose value will be unique for each row). Index on other hand enables seacrching of records easier within a table. there are various kinds of indexes like Clustered,Non clustered, Unique,..Clustered Index causes the table to be physically sorted by indexed column value. There can be only a single clustered index.Non clustered index causes index information to be stored seperately and it points to clustered index to find position.Unique index ensures values in column are unique. Creation of primary key creates a CLUSTERED index and UNIQUE constraints creates a NONCLUSTERED index. If you've unique constraint already, creation of PK creates a NONCLUSTERED index. |
 |
|
|
|
|
|