HPlogo Up and Running with ALLBASE/SQL: HP 3000 and HP 9000 Computer Systems > Chapter 1 Very Basic...

What Is a Relational Database?

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

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. SQL statements that use these operations are known as queries. Three queries that use the SQL SELECT statement to illustrate selection, projection, and joining are shown in Figure 1-1.

Figure 1-1 Relational Operations

[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.

  • A column can contain NULL values if you allow it to.

Sample Database Table

The following is a portion of a database table consisting of names and account balances for an employee credit union:

Table 1-1 Employee Accounts

Last NameFirst NameTelephoneEmployee NumberBalance
HarrisonGerald72332432099142.59
AbelsonAnnette431235100442345.09
StanleyPeterNULL3540011321.98
WaltersGeorgia255491247721230.10

 

Notice that the third row contains a NULL value in the third column instead of a value for Telephone.

Data Types and Sizes

Each column can accept data of a specific type and size. Here is the breakdown for the sample table above:

Column Name

Data Type

Last Name

VARCHAR(15)

First Name

VARCHAR(15)

Telephone

SMALLINT

Employee Number

INTEGER

Balance

DECIMAL(10,2)

Data types are described further in chapter 2.

Using Several Tables

You can put the same data into several different tables such as the following:

Table 1-2 Employees Table

Last NameFirst NameEmployee Number
HarrisonGerald2432099
AbelsonAnnette3510044
StanleyPeter3540011
WaltersGeorgia9124772

 

Table 1-3 Telephone Table

Last NameFirst NameTelephone
HarrisonGerald7233
AbelsonAnnette4312
StanleyPeterNULL
WaltersGeorgia2554

 

Table 1-4 Accounts Table

Employee NumberAccount Balance
2432099142.59
35100442345.09
3540011321.98
91247721230.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, sometimes known as a schema, for your database.

Chapter 2 presents an introduction to data analysis and database design.