A relation is a data structure which consists of a heading and an unordered set of tuples which share the same type.
A relation is a data structure which consists of a heading and an unordered set of tuples which share the same type.
When Edgar F. Codd invented the relational model, he generalized the concept of binary relation (mathematical relation) to n-ary relation. Relation is a fundamental concept in relational model.
- A relation has zero or more tuples.
- A relation value is an instance of a relation.
- A relation variable (relvar) is a variable which has a relation value.
In some contexts, relation means relation variable. In other contexts, relation means relation value.
In SQL, a database language for relational databases, a relation variable is called a table. Relational model concepts including relation
A relation value, which is assigned to a certain relation variable, is time-varying. By using a Data Definition Language (DDL), it is able to define relation variables.
- A heading is the unordered set of certain attributes (columns). A heading has zero or more attributes.
- A body is the unordered set of tuples, which constitutes a relation value. In other words, a relation value consists of a heading and a body.
- A tuple is a data structure which consists of the unordered set of zero or more attributes.
- An attribute (column) is a pair of its attribute name and domain name. Domain can be considered data type, or simply, type.
- An attribute has an attribute value which conforms to its domain. An attribute value is a scalar value or a more complex structured value.
- The degree of a relation is the number of attributes which constitute a heading. The degree of a relation value is zero or more integer. An n-ary relation is a relation value in which its degree is n.
- The cardinality of a relation is the number of tuples which constitutes a relation value. The cardinality of a relation value is zero or more integer.
There are no duplicate tuples in a relation value. A candidate key is a certain minimal set of one or more attributes that can uniquely identify individual tuples in a relation value.