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.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Primary Key vs Composite Key

Author  Topic 

briankind
Starting Member

17 Posts

Posted - 2009-07-25 : 02:12:43
what is a Primary Key vs Composite Key when do i use them?

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-07-25 : 02:15:31
In Primary key single field (i.e column) acts as key

In Composite Primary key more the one column acts as Primary Key..

You want more details go through Books or just google it..

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-07-25 : 02:17:43
Follow this

http://www.google.co.in/search?hl=en&q=primary+key+vs+composite+key&btnG=Google+Search&meta=&aq=0&oq=primary+key+vs+com

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

dportas
Yak Posting Veteran

53 Posts

Posted - 2009-07-25 : 05:23:58
A composite key is any candidate key with more than one attribute.

A primary key is any one of the candidate keys (composite or not) of a relation (or relation variable or "table").

For relations with more than one key the idea of designating a "primary" key at all is arguably a fairly arbitrary and flexible concept. It just means that one key is chosen to be of special significance for some possibly unspecified reason. However, the primary key is often seen as very important in SQL database design because it is usually assumed that the primary key will be the one referenced by foreign keys in other tables and that therefore the management of those primary keys is a special consideration during design.
Go to Top of Page
   

- Advertisement -