Notes > Database Systems > Relational Database Principles and Terminology
A relational database is a collection of 2-dimensional tables which consist of rows and columns. Tables are known as "relations", columns are known as "attributes" and rows (or records) are known as "tuples".
Tables / Relations are a logical structure therefore they are an abstract concept and they do not represent how the data is stored on the physical computer system. Each column / attribute in a relation represents an attribute of an entity. A single row / tuple contains all the information (in the form of attributes) about a single entity.
The "cardinality" of a relation is the number of row / tuples it has. The "degree" of a relation refers to the number of columns / attributes in that relation. The order of records and columns is irrelevant. Relations and columns should always be uniquely named and therefore uniquely indentifiable. No duplicate rows occur in a single relation.
Each cell of a relation contains a single value or element which is atomic. This means that arrays or lists, for example, would not be stored under a single attribute. Multi-valued attributes are possible though but this involves a technique of referring to another relation which holds these multiple values.
Attribute domains define the set of all possible values an attribute within a relation can take. For example, the attribute "height" of a person may only take integer values with a 4 digit maximum (if measuring in millimetres). The attribute "gender" may only take a string of length 1 with the only two characters accepted being "m" or "f" representing male or female. Defining attribute domains allows the database to reject invalid inappropriate data.
An attribute may in some cases be permitted to contain Null values. A Null value makes it possible to deal with missing or erroneous data. Null means that there is an absence of a value. It is different from using a blank space or zero value in an attribute.
Keys (Primary, Candidate, and Foreign)
A key (also known as a candidate key) is an attribute which uniquely identifies a row / tuple within a relation. The primary key is the key chosen by the database designer as the main identifier for all records in that relation (even though other keys could be used as the primary key). A foreign key is an attribute which provides a logical link between tables. A foreign key in one relation will correspond to a key within another relation. Candidate keys can consist of a single attribute or multiple attributes. Multiple attribute keys are known as composite keys.
Search for "Relational Database Principles and Terminology" on:
eBay (UK) |
Search for "Relational Database Principles and Terminology" on the rest of Computing Students: Relational Database Principles and Terminology