Candidate key

candidatekey candidateskeysnon-prime attribute
In the relational model of databases, a candidate key of a relation is a minimal superkey for that relation; that is, a set of attributes such that: * 1) the relation does not have two distinct tuples (i.e. rows or records in common database language) with the same values for these attributes (which means that the set of attributes is a superkey) * 2) there is no proper subset of these attributes for which (1) holds (which means that the set is minimal).wikipedia
34 Related Articles

Relational model

relationalrelational data modelrelationships
In practice, several useful shorthands are expected to be available, of which the most important are candidate key (really, superkey) and foreign key constraints.


A candidate key is a minimal set of attributes necessary to identify a tuple; this is also called a minimal superkey.

Functional dependency

functional dependenciesfunctionally dependentinspired from relational database theory
e.g. from the set of functional dependencies.
(Unions of attribute sets are customarily denoted by mere juxtapositions in database theory.) An important notion in this context is a candidate key, defined as a minimal set of attributes that functionally determine all of the attributes in a relation.

Compound key

composite keycomposite primary keyCompound
In database design, a composite key is a candidate key that consists of two or more attributes (table columns) that uniquely identify an entity occurrence (table row).

Primary key

Alternate keydefining database keykey
Informally, a primary key is "which attributes identify a record", and in simple cases are simply a single attribute: a unique id. More formally, a primary key is a choice of candidate key (a minimal superkey); any other candidate key is an alternate key.

Relational database

relational database management systemRDBMSrelational databases
If the tuple contains a candidate or primary key then obviously it is unique; however, a primary key need not be defined for a row or record to be a tuple.

Database normalization

normalizationnormalizednormal form
The Book table has one candidate key, the compound key {Title, Format}.

Database schema

schemarelational schemaschemas
As such they are an important concept for the design of database schema.


Base relvarrelation variablerelvars
Consider a relation variable (relvar) R with attributes (A, B, C, D) that has only the following two legal values r1 and r2:


supersetproper subsetsubsets
: {B,C}, {A,B,C}, {A,B,D}, {A,C,D}, {B,C,D}, {A,B,C,D}Finally we need to select those sets for which there is no proper subset in the list, which are in this case:


permutationscycle notationpermuted
However there are many more permutations of attributes (n!)

Power set

Unique key

keykeysprimary key
A relational database table may have one or more available keys (formally called candidate keys).

Foreign key

Foreignforeign key constraintforeign key references
In the context of relational databases, a foreign key is a set of attributes subject to a certain kind of inclusion dependency constraint, specifically a constraint that the tuples consisting of the foreign key attributes in one relation, R, must also exist in some other (not necessarily distinct) relation, S, and furthermore that those attributes must also be a candidate key in S. In simpler words, a foreign key is a set of attributes that references a candidate key.

Referential integrity

Declarative Referential Integrityreferential integrity constraintforeign-key candidates
For referential integrity to hold in a relational database, any column in a base table that is declared a foreign key can only contain either null values or values from a parent table's primary key or a candidate key.

Third normal form

3NF3NF databasesthird
A non-prime attribute of R is an attribute that does not belong to any candidate key of R. A transitive dependency is a functional dependency in which X → Z (X determines Z) indirectly, by virtue of X → Y and Y → Z (where it is not the case that Y → X).

Dependency theory (database theory)

dependency theorydependenciesdependency
The best known class of such dependencies are functional dependencies, which form the foundation of keys on database relations.

Fifth normal form

A table is said to be in the 5NF if and only if every non-trivial join dependency in that table is implied by the candidate keys.

Surrogate key

Some database designers use surrogate keys systematically regardless of the suitability of other candidate keys, while others will use a key already present in the data, if there is one.