2

Can anyone please give me a clear idea of the difference of these keys?

  1. Compound key
  2. Composite Key
  3. Concatenated Key
  4. Aggregate Key
  5. Candidate Key

I searched for the definitions of all these and it seems some of them are just synonyms. But not sure if I understood then correctly. I would be thankful if someone can come up with a descriptive answer comparing the differences and similarities.

Milindu Sanoj Kumarage
  • 2,714
  • 2
  • 31
  • 54
  • 1
    possible duplicate of [Key, Superkey, Minimal Superkey, Candidate Key, Primary Key DIFFERENCES](http://stackoverflow.com/questions/6951052/key-superkey-minimal-superkey-candidate-key-primary-key-differences) – Lion Jun 23 '13 at 06:12
  • @Lion sir, there is no mention about Compound key, Composite Key, Concatenated Key and Aggregate Key. – Milindu Sanoj Kumarage Jun 23 '13 at 06:15
  • 1
    I'm not sure about compound key but composite key and concatenate(d) key refer to the same. It is candidate key. It is also mentioned there. – Lion Jun 23 '13 at 06:20

1 Answers1

2

In relational database terms there is only one fundamental type of key: a candidate key.

A candidate key is a set of attributes that is irreducibly unique and non-nullable within a table. Irreducible means that all the attributes of the key are necessary to guarantee uniqueness - remove any one attribute and the uniqueness property would be lost. A key may consist of zero, one or more attributes and a relational table (relation variable) must have at least one key and may have more than one.

Compound, composite, concatenated and aggregate are all alternative terms used to describe candidate keys with more than one attribute. A candidate key with exactly one attribute is called a simple key

nvogel
  • 24,981
  • 1
  • 44
  • 82
  • http://en.wikipedia.org/wiki/Compound_key Sir, in this wiki article there says Compound key is often confused with composite key. This made me to ask this question in SO . Are they really alternative terms? – Milindu Sanoj Kumarage Jun 23 '13 at 06:36
  • In Relational terms they are the same thing; in Entity-Relationship Modelling they are subtly different. See: http://dba.stackexchange.com/questions/3134/in-sql-is-it-composite-or-compound-keys – nvogel Jun 23 '13 at 06:41
  • It is odd that this got closed for "Off Topic"! Either way - this is an incomplete answer because a composite key is one that can contain non simple key fields. A compound key contains only simple key fields. – Cheesus Toast Jul 02 '16 at 22:11