3. RELATIONAL DATABASE MODELS
The relational model is today the primary data model for commercial data processing
applications. It attained its primary position because of its simplicity, which eases the job of the
programmer, compared to earlier data models such as the network model or the hierarchical
model.
The relational model uses a collection of tables to represent both data and the relationships
among those data. Tables are logical structures maintained by the database manager. The
relational model is a combination of three components;
Structural part – this defines the database as a collection of relations.
Integrity part – Integrity in a database is maintained in a relational model using primary
and foreign keys.
Manipulative part – these are tools that are used to manipulate data in a database, usually
relational calculus and algebra.
Basics of a relational model
Relation
The relational model gives us a single way to represent data, that is, as a two-dimensional table is
called a relation. A relational database consists of a collection of tables, each of which is
assigned a unique name. For instance, consider the table below named Instructor. The table has
four column headers: ID, name, dept_name, and salary. Each row of this table records
information about the instructor, consisting of their id, name, department, and salary.
1
, In general, a row in a table represents a relationship among a set of values. Since a table is a
collection of such relationships, there is a close correspondence between the concept of a table
and the mathematical concept of relation, from which a relational data model derives its name.
In mathematical terminology, a tuple is simply a sequence (or a list) of values. A relationship
between n values is represented mathematically by an n-tuple, that is, a tuple of n values, which
corresponds to a row in a table.
NB: for a table to be a relation, the following rules must hold;
The intersection of row with column should contain single (atomic) value.
All entries in a column are of the same type.
Each column has a unique name and column order not significant
No two rows are identical and row order not significant.
Attributes
The columns of a relation are named by attributes. Attributes appear at the tops of the columns.
Usually, an attribute describes the meaning of entries in below each column. For instance, the
column with attribute ID in the relation Instructor holds the Identity number of each instructor.
Tuples
The rows of a relation, other than the header row containing the attribute names, are called
tuples. A tuple has one component for each attribute of the relation. For example, the first tuple
in the Instructor relation above has the components 10101, Srivansan, Comp. Sci. and 65000 for
attributes ID, name, dept_name and salary, respectively. When we wish to write a tuple in
isolation, that is, not as part of the relation, we normally use commas to separate components,
and parentheses to surround the tuple. For example,
(10101, Srivansan, Comp. Sci., 65000),
is the first isolated tuple of the instructor relation above. NB: when a tuple appears in isolation,
the attributes do not appear and therefore, some indication of the relation to which the tuple
belongs must be given. Usually, the order in which the attributes were listed in the relation
schema is used.
Domains
For each attribute of a relation, there is a set of permitted values, called the domain of that
attribute, that is, a particular elementary type. The components of any tuple of the relation must
have, in each component, a value that belongs to the domain of the corresponding column. For
2
The relational model is today the primary data model for commercial data processing
applications. It attained its primary position because of its simplicity, which eases the job of the
programmer, compared to earlier data models such as the network model or the hierarchical
model.
The relational model uses a collection of tables to represent both data and the relationships
among those data. Tables are logical structures maintained by the database manager. The
relational model is a combination of three components;
Structural part – this defines the database as a collection of relations.
Integrity part – Integrity in a database is maintained in a relational model using primary
and foreign keys.
Manipulative part – these are tools that are used to manipulate data in a database, usually
relational calculus and algebra.
Basics of a relational model
Relation
The relational model gives us a single way to represent data, that is, as a two-dimensional table is
called a relation. A relational database consists of a collection of tables, each of which is
assigned a unique name. For instance, consider the table below named Instructor. The table has
four column headers: ID, name, dept_name, and salary. Each row of this table records
information about the instructor, consisting of their id, name, department, and salary.
1
, In general, a row in a table represents a relationship among a set of values. Since a table is a
collection of such relationships, there is a close correspondence between the concept of a table
and the mathematical concept of relation, from which a relational data model derives its name.
In mathematical terminology, a tuple is simply a sequence (or a list) of values. A relationship
between n values is represented mathematically by an n-tuple, that is, a tuple of n values, which
corresponds to a row in a table.
NB: for a table to be a relation, the following rules must hold;
The intersection of row with column should contain single (atomic) value.
All entries in a column are of the same type.
Each column has a unique name and column order not significant
No two rows are identical and row order not significant.
Attributes
The columns of a relation are named by attributes. Attributes appear at the tops of the columns.
Usually, an attribute describes the meaning of entries in below each column. For instance, the
column with attribute ID in the relation Instructor holds the Identity number of each instructor.
Tuples
The rows of a relation, other than the header row containing the attribute names, are called
tuples. A tuple has one component for each attribute of the relation. For example, the first tuple
in the Instructor relation above has the components 10101, Srivansan, Comp. Sci. and 65000 for
attributes ID, name, dept_name and salary, respectively. When we wish to write a tuple in
isolation, that is, not as part of the relation, we normally use commas to separate components,
and parentheses to surround the tuple. For example,
(10101, Srivansan, Comp. Sci., 65000),
is the first isolated tuple of the instructor relation above. NB: when a tuple appears in isolation,
the attributes do not appear and therefore, some indication of the relation to which the tuple
belongs must be given. Usually, the order in which the attributes were listed in the relation
schema is used.
Domains
For each attribute of a relation, there is a set of permitted values, called the domain of that
attribute, that is, a particular elementary type. The components of any tuple of the relation must
have, in each component, a value that belongs to the domain of the corresponding column. For
2