# CHAPTER 1: Introduction

## 1.1 Empress - A Relational Database Management System

A database management system is an integrated system of computer programs and files for organizing, storing, and retrieving data.

A relational database management system (RDBMS) organizes data into structures known as relations or tables. Each table is identified by a unique table name, and has a fixed number of columns and a variable number of rows. The columns are called attributes and each is labeled with an attribute name. All data values under a given attribute are of the same type, such as integer or character. Each row in a table is called a record, or tuple, with one data value for each attribute.

Tables may be created or removed from the database as required. New records may be added to them, and existing records may be updated or deleted. Most importantly, data may be selectively retrieved from tables according to certain criteria. These criteria usually involve the values of one or more of the attributes of given tables. For example, you may retrieve all the records from a table where one attribute has some specific value.

Most commands to a database management system are issued via a Structured Query Language (SQL), which is similar in form to a natural language. Structured Query Language commands are often referred to simply as "queries".

Empress is a relational database management system. With Empress you can use English-like commands to create a new database, query a database for information, and manage the information in a database. Commands may be used conversationally from a terminal, submitted in batches from files, or embedded in an application program.

Empress has an SQL language which uses simplified English sentences, making it easy to learn and straightforward to use. Generally, commands to do something, such as insert data into a table or select data from one, are phrased in the SQL language much as they would be in English.

## 1.2 The Example Database

This manual contains syntax reference for the Empress Query Language commands. Other topics, such as command logging, the database loader, export/import utilities, the data dictionary, administrative variables, system supplied help and adding customized help files are discussed in the Empress: Database Administrator's Guide.

Note that this manual is not a tutorial, the examples in this manual section are based on the tables `personnel`, `loans`, `auto parts`, and `customers` described in this chapter. The effects of previous commands are not considered when the output of a command is shown.

Examples given in this manual feature a database called `repairs` which contains these four tables:

1. A `personnel` table of personnel records which containing employees' personnel numbers, names, phone numbers, and credit limits for loans. It has attributes named `number`, `name`, `phone`, and `credit_limit`. The `personnel` table has one record for each employee.
2. A `loans` table containing information about loans made to employees which contains the employee's name, the date on which the loan was made, and the amount. It has attributes called `number`, `name`, `date`, and `amount`. The `loans` table may have more than one record for each employee.
3. An `auto parts` table which holds records of various auto part suppliers with the attributes `supplier`, `phone`, `part name`, `part no.`, and `price`.
4. A `customers` table which holds customers' names and addresses, and some comments about them with the attributes `name`, `address`, and `comments`.

The four tables hold the following data:

  *** Table: personnel ***

  number | name | phone | credit_limit
  10 | Kilroy | 426-9681 | $500.00
  5 | Mosca | 544-2243 | $750.00
  17 | Wladislaw | 723-6073 | $50.00
  3 | Jones | 667-2951 | $500.00
  8 | Peterson | 978-6060 | $250.00
  4 | Scarlatti | 961-7363 | $100.00
  9 | Jordan | 964-3335 | $250.00

  *** Table: loans ***

  number | name | date | amount
  5 | Mosca | 2 February 1990 | $150.0
  3 | Jones | 7 February 1990 | $33.95
  10 | Kilroy | 16 February 1990 | $250.00
  17 | Wladislaw | 27 February 1990 | $55.00
  3 | Jones | 3 April 1990 | $25.00
  5 | Mosca | 4 May 1990 | $200.00
  17 | Wladislaw | 12 May 1990 | $25.00
  8 | Peterson | 6 June 1990 | $50.00
  17 | Wladislaw | 25 June 1990 | $75.00
  3 | Jones | 12 August 1990 | $300.00
  4 | Scarlatti | 9 September 1990 | $150.00
  4 | Scarlatti | 14 October 1990 | $125.00

  *** Table: auto parts ***

  supplier | phone | part name | part no. | price
  AAA Automotive | 922-8624 | Hubcap | 9836653 | $18.40
  AAA Automotive | 922-8624 | Fender rubber | 9837521 | $47.95
  AAA Automotive | 922-8624 | Fender chrome | 9837522 | $67.95
  Rick's Repairs | 675-4436 | Spark plugs | 243 | $1.25
  Speedy Body Shop | 643-8994 | Rear wing | 87003 | $75.00
  Speedy Body Shop | 643-8994 | Front wing | 87005 | $79.99
  Rick's Repairs | 675-4436 | Radiator | 493 | $175.00
  Auto Wholesalers | 922-6219 | Spray paint | 2198 | $1.25
  Auto Wholesalers | 922-6219 | Chrome paint | 3286 | $1.99

  *** Table: customers ***

  name | address | comments
  Mr. R. Lucas | 1423 Beach Drive, Bayville, CA 92308 | Can always be sold something new and flashy - like chrome and colored stuff, also little gadgets.
  Mr. J. Phillips | 63 Shore Bvde., Gull Point, CA 92309 | Pays bills 2 months late -- needs to be threatened with a collection agency.
  Mr. B. Wilson | 14 Valley View Drive, Bayville, CA 92308 | Good customer -- give credit if he asks for it.
  Ms. C. Marshall | 12 Berkeley St., Gull Point, CA 92309 | Suggest vacuum & wash; she keeps 3 dogs. Look for dog hair collecting in engine.
  Mr. J. Lee | 3260 Church St., Gull Point, CA 92309 | Father pays bills -- check with R. Lee before accepting a job, but don't let Johnny know you're doing so.

In the following chapters, the `personnel`, `loans`, `auto parts`, and`customers` tables will be used extensively to illustrate the various Empress features and commands.

The commands and syntax used to create the tables are found in the `CREATE TABLE` command in this manual.