5.2 Relational Database Concepts


A number of definitions are provided below of the main elements used in a relational database:

Domain: is a set of values that define the value range for an attribute. A domain can be considered as a data type. Examples of domains include integer, float, string, date, etc.
Attribute: is the basic unit in a relation (table) definition. Each attribute has a domain associated with it. It can be considered as a column in relational database table.
Relation Schema (Table Schema): defines the structure of a relation (table) which consists of a set of attributes and an association between each attribute and its domain (specifying the possible values of an attribute).
Relational Database Schema: that is a collection of relation (table) schemas.
Tuple (Record/row): that is a list of values with each value being an element in a domain or NULL. A tuple represent a record or row in a table (relation).
Relation (Table): is one instance of a relation schema which is composed of a set of tuples.
Relational Database: is a collection of relations (tables).
The elements defined above can be categorized into two groups,
One group of elements are used for defining a relational database
The other group of elements are concerned with using the database.


5.2 Relational Database Concepts


Figure 5.1 illustrates the definition of Library database.
A database schema is defined which consists of two relation (table) schemas: Books and Members.
As shown in the books table schema in Figure 5.1, the schema defines the structure of the table specifying the attributes of the table (book_Id, title, author, publisher and publication_date).
Each attribute is associated with a domain in the schema, e.g. attribute title has domain text which specifies that values of attribute title are of type text.


5.2 Relational Database Concepts


5.2 Relational Database Concepts


Figure 5.2 illustrates the library database instance.
It can be seen that the library database consists of two relations (tables): books and members.
The books table is an instance of the books table schema shown in Figure 5.1.
The books table consists of tuples (records/rows).
Each tuple is composed of values for the attributes defined in the table schema.
Each value in a table tuple is part of the domain associated with the corresponding attribute in the table schema.
For example, value ’A Tale of Two Cities’ in the 1st tuple of the book table is a value of attribute title with domain text as defined in the table schema (shown in Figure 5.1).


5.2 Relational Database Concepts