Chapter 3. Relational Databases
A relational database (RDB) consists of a set of relational tables, such as the tables People and Movies shown in Section 1.1 above. The columns of a relational table only contain elementary (non-composite) data values. This means, for example, that we cannot have a column like "Phone numbers" with one or more strings (representing the various phone numbers of a person) as its value, since such a value list is a composite data value that has to be decomposed into elementary data values for being included in a relational table.
Since a database needs to accommodate information about entities and relationships between them, there are essentially two kinds of tables in an RDB: entity tables and relationship tables. The rows of an entity table represent entities of a certain type, such as people or movies. The rows of a relationship table represent relationships of a certain type, such as the is-an-actor-in relationships between Uma Thurman and Pulp Fiction as well as between Keanu Reeves and Dangerous Liaisons. Notice that the corresponding rows of the table is_an_actor_in
are ordered pairs of people identifiers and movie identifiers such as ⟨"UT", "Pulp Fiction"⟩ and ⟨"KR", "Dangerous Liaisons"⟩, assuming for simplicity that the IDs of people are their initials and the IDs of movies are their titles.These two table rows correspond to the fact statements "UT" is-an-actor-in "Pulp Fiction" and "KR" is-an-actor-in "Dangerous Liaisons".
Also, each value in a column of an entity table corresponds to a fact statement. For instance, the value "12.05.1994" in the column "Release date" for the movie with ID 1 (and title "Pulp Fiction") corresponds to the fact statement "The movie with ID 1 has the release date 12.05.1994". Notice that this statement involves three (underlined) items: an entity (movie with ID 1), an attribute (release date) and a value (12.05.1994). Therefore, this type of fact statements is also called entity-attribute-value triples.
These considerations show that, semantically, the information items in an RDB represent fact statements. A DB information item is correct with respect to a state of affairs, if the corresponding fact statement is true in that state of affairs, that is, if the real world's state of affairs includes the corresponding fact that makes the statement true.
We show in the following sections, how to
- create an RDB,
- populate its tables by adding table rows representing entities or relationships,
- update and delete table rows.
- retrieve information about entities and their relationships by issuing queries,