Search code examples
relational-databaseprimary-key

What are the attributes called which combine to form a primary key?


What are the attributes called which combine to form a primary key?

The answer given is superkey which seems wrong. I reckon prime attribute.


Solution

  • What are the attributes called which combine to form a primary key?

    Under the relational model:

    There's no such special term. The attributes that appear in some CK (candidate key) are called the prime attributes. A PK (primary key) is one CK that you decided to call the PK.

    The attributes of a PK are prime, but not all prime attributes need to be attributes of a PK, since there can be CKs other than the PK, or maybe no CK was chosen as PK.

    If a relation has only one CK & it is the PK then the PK's attributes are the prime attributes.

    But we don't need a special term since we could just say "PK attribute". Just like we don't need "prime" since we could just say "CK attribute".

    The answer given is Super key

    A superkey is a set of columns whose values are unique. A CK is a superkey that contains no smaller superkey. So a PK is a superkey. But there can be superkeys that are not CKs or PKs--every larger superset of a CK.

    PS In SQL, assuming no duplicate rows or duplicate columns names or nulls, so we can take a table to be a relation in the obvious way & apply relational terminology, a UNIQUE declaration or so-called PK declaration declares a superkey.