1 Introduction to Query

Introduction to Database Management

A database is a collection of related information, commonly accessible, that has been stored in such a way that easy access to the information is made possible. The person who designs the database decides what information will be in the database and how each piece of information is related to every other piece of information. To use Query, you need not know the process the designer uses to create the database, but you do need to know what the information is and how it is organized.

The information stored in the database depends upon the use of the database. Throughout this manual, a sales analysis example is used. This is only an example to show you how to work with the database. After you have read this first section, ask your manager or the person in charge of the computer system what information your database stores.

Data Item

The smallest piece of information in a database is called a data item. For example, a customer name would be a data item, a customer address would be another data item. When the database is designed, a certain amount of space is reserved for storing the contents of each data item. For example, assume the customer information is stored in a card file. The first line might be reserved for the customer's name, the next two lines for the address, and so on.

Figure 1 Example Data Items

Thus the first data item uses the first line and the second data item uses the next two lines. Note that cards are not really used for storage. This is only an example to help you visualize data items.

When it becomes necessary to find the card which contains the customer Jon Doe, you need a way to specify which line on each card is to be searched. Consequently, each data item is assigned a name and length. For example, the first data item might be named "customer" and have a length of one line. (When stored in the database, the length is actually specified as a number of characters or digits.)

Data Entry

The next level in the database system is the data entry. All the data items on a card might be defined as a data entry.

Figure 2 Data Entry Example

The figure shows a data entry that consists of 13 data items.

Data Set

A collection of similar data entries is known as a data set. The following figure shows three data entries which together make up a particular data set that will be referred to as the CUSTOMER data set. A data set is similar to a file.

Figure 3 Example Data Sets

A collection of data sets is called a database. The data sets in a database are usually linked together. For example, a second data set in the Sales Analysis database contains the data items ORDER_NO, OPTION_DESC, OPTION_PRICE and OPTION_TYPE; this data set is referred to as the OPTION data set. Because the information in this data set may be wanted with the information in the customer data set, the two are linked together through a third data set, ORDER, which has one data item ORDER_NO. This link from one data set to another is called a data path.

Figure 4 Example Data Path

The data item which is linked is called a key item.

Now assume the customer specifies two options on the same order. This would cause the option data set to have two entries with the same order number. These entries are also linked through the key item. This link, within a data set, is called a data chain.

Figure 5 Example Data Chain

Types of Data Sets

There are two types of data sets, master data sets and detail data sets.

In a master data set, there is only one data entry for each key item value. There may be up to 16 data paths from this key item.

In a detail data set, there may be more than one data entry for each key item value. There may be up to sixteen key items in a data entry. For every value of a key item in a detail data set, there is a corresponding value in its associated master data set.

For example, the order data set has one data entry for each ORDER_NO value. The option data set has two data entries for ORDER_NO 0001. Since there is a value of 0001 in the option data set ORDER_NO data item, there must be a value of 0001 in the order data set ORDER_NO data item. However, there does not have to be the same value in the customer data set.

There are two types of master data sets. The automatic master data set contains one data item which is a key item. When a new value is added to the same key item in a detail data set, the value is automatically added to the automatic master data set. Deletions from the automatic master data set are made when the last data entry with a particular key item value is deleted from the detail data set.

The manual master data set contains one or more data items, one of which is a key item. Before a new key item value can be added to a detail data set that is linked to a manual master data set, the value must be first added to the manual master data set.

Database

The collection of multiple detail data sets and master data sets is collectively known as a database. As the information is stored into the database, no ordering is necessary since the links provide the ordering. All data chain maintenance is performed automatically.

The following is a diagram of the Sales Analysis database showing the data paths between master and detail data sets.

Figure 6 Sales Analysis Database


Eloquence Query Manual - 19 DEC 2002