Database Relation Definition

Database Relation Properties Ensure Data Integrity

A common term used in database design is a "relational database" — but a database relation is not the same thing and does not imply, as its name suggests, a relationship between tables.

Rather, a database relation simply refers to an individual table in a relational database.

In a relational database, the table is a relation because it stores the relation between data in its column-row format. The columns are the table's attributes, while the rows represent the data records.

A single row is known as a tuple to database designers.

The Definition and Properties of a Relation

A relation, or table, in a relational database has certain properties. First off, its name must be unique in the database, i.e. a database cannot contain multiple tables of the same name. Next, each relation must have a set of columns, or attributes, and it must have a set of rows to contain the data. As with the table names, no attributes can have the same name. 

Next, no tuple (or row) can be a duplicate. In practice, a database might actually contain duplicate rows, but there should be practices in place to avoid this, such as the use of unique primary keys (next up).

Given that a tuple cannot be a duplicate, it follows that a relation must contain at least one attribute (or column) that identifies each tuple (or row) uniquely. This is usually the primary key. This primary key cannot be duplicated.

This means that no tuple can have the same unique, primary key. The key cannot have a NULL value, which simply means that the value must be known.

Further, each cell, or field, must contain a single value. For example, you cannot enter something like "Tom Smith" and expect the database to understand that you have a first and last name; rather, the database will understand that the value of that cell is exactly what has been entered.

Finally, all attributes — or columns — must be of the same domain, meaning that they must have the same data type. You cannot mix a string and a number in a single cell.

All these properties, or constraints, serve to ensure data integrity, important to maintain the accuracy of data.