What Is a Relational Database? [ Getting Started with HP IMAGE/SQL ] MPE/iX 5.0 Documentation
Getting Started with HP IMAGE/SQL
What Is a Relational Database?
A relational database is a collection of data arranged in tables, also
known as relations. Tables are subject to the following relational
operations, each of which lets you retrieve data in a specific way:
* Selection, which lets you extract a subset of rows.
* Projection, which lets you extract a subset of columns.
* Joining, which lets you extract from more than one table at a
time.
In practice, these operations frequently appear together. An SQL
statement that uses these operations is known as a query. Three queries
that use the SQL SELECT statement to illustrate selection, projection,
and joining are shown in Figure 2-1.
Figure 2-1. Relational Operations
Rows and Columns
When you look at data in relational terms, you can assume several things:
* Tables are arranged in rows and columns, which are like records
and fields in an ordinary file.
* Each column has a specific data type and size.
* Each row contains one element for every column.
Sample Database Table
The following is a portion of a database table consisting of names and
account balances for an employee credit union:
Employee Accounts
-----------------------------------------------------------------------------------------------------
| | | | | |
| Last Name | First Name | Telephone | Employee Number | Balance |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| Harrison | Gerald | 7233 | 2432099 | 142.59 |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| Abelson | Annette | 4312 | 3510044 | 2345.09 |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| Stanley | Peter | 1235 | 3540011 | 321.98 |
| | | | | |
-----------------------------------------------------------------------------------------------------
| | | | | |
| Walters | Georgia | 2554 | 9124772 | 1230.10 |
| | | | | |
-----------------------------------------------------------------------------------------------------
Each column can accept data of a specific type and size. Refer to
Chapter 3, "Moving from TurboIMAGE/XL to IMAGE/SQL," for more details on
data types.
Using Several Tables
You can put the same data into several different tables, as shown below:
Table 1. Employees Table
----------------------------------------------------------------------------------------------
| | | |
| Last Name | First Name | Employee Number |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Harrison | Gerald | 2432099 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Abelson | Annette | 3510044 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Stanley | Peter | 3540011 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Walters | Georgia | 9124772 |
| | | |
----------------------------------------------------------------------------------------------
Table 2. Telephone Table
----------------------------------------------------------------------------------------------
| | | |
| Last Name | First Name | Telephone |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Harrison | Gerald | 7233 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Abelson | Annette | 4312 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Stanley | Peter | 1235 |
| | | |
----------------------------------------------------------------------------------------------
| | | |
| Walters | Georgia | 2554 |
| | | |
----------------------------------------------------------------------------------------------
Table 3. Accounts Table
---------------------------------------------------------------------------------------------
| | |
| Employee Number | Account Balance |
| | |
---------------------------------------------------------------------------------------------
| | |
| 2432099 | 142.59 |
| | |
---------------------------------------------------------------------------------------------
| | |
| 3510044 | 2345.09 |
| | |
---------------------------------------------------------------------------------------------
| | |
| 3540011 | 321.98 |
| | |
---------------------------------------------------------------------------------------------
| | |
| 9124772 | 1230.10 |
| | |
---------------------------------------------------------------------------------------------
You decide which arrangements of data work best for you by using the
processes of data analysis and database design.
In data analysis, you investigate the various ways your data can be used.
In database design, you create specific table structures based on your
analysis. The design phase results in a set of table descriptions, known
as a schema, for your database.
MPE/iX 5.0 Documentation