# Relational Theory Can be as Fun as It Sounds

Learning about the relational model and relational theory has been interesting. Here are some things I’ve learned thus far:

## A few definitions

### Tuple

A tuple is an ordered list of values or elements.

The term originated as an abstraction of the sequence: single, double, triple, quadruple, quintuple, sextuple, septuple, octuple, …, n-tuple, …, where the prefixes are taken from the Latin names of the numerals.

### Set, Type or Domain

A set, type or domain is a set of all valid input values.
f(x) = 2x + 1
Domain = All real numbers
f(5) = 2(5) + 1 = 11

f(x) = x-1/2
Domain = All values of x > 0
f(9) = (9)^(-1/2) = 3
f(-1) = (-1)^(-1/2) = undefined (Not valid!)

### Attribute

An attribute is an ordered pair of attribute name and type name (i.e. Attribute-name:Attribute-type; EmployeeID:INTEGER). An attribute value is a specific valid value for the domain of the attribute. This can be either a scalar value or a more complex type.

### Relation

Given sets S1, S2, …, Sn (not necessarily distinct), R is a relation on these n sets if it is a set of n-tuples each of which has its first element from S1, its second element from S2, and so on (More concisely, R is a subset of the Cartesian product S1 * S2 * … * Sn). (Codd, 1970)

## References

Codd, E. F. (1970).
A Relational Model of Data for Large Shared Data Bank
. Communications of the ACM, 13(9), 377-387.