Introduction to Databases
The term "database" evokes different images for different people, but the concept is not technical. It is as easy to envision as a file cabinet in an office. The file cabinet and its contents are the database. Anytime that the pieces of paper pertaining to a specific function, such as a customer address file in a file cabinet, are rearranged in a meaningful order (for example, alphabetically by last name), some sort of data management function has been performed.
Thus, the average office file cabinet is a database. It doesn't do anything; it just holds information. Whenever a drawer of the file cabinet is opened to find a record (for example, the record for the customer Smith), the database must be searched. This process of searching the database is actually a way to manage it. Databases are typically stored in some order, usually alphabetically by last name, city, or region. This provides for easier data management.
Before proceeding further, some key terms pertaining to the topic of databases, must be defined. A database holds information that is related to a specific type of application. In this context, it is synonymous with a file.
A record relates to the "entity" that contains information about a specific business "happening" or transaction in the database. There are typically many records in a database. Each record holds information about a business transaction.
A record comprises one or more fields. It is the concept of the field that allows information to be stored about a transaction or business event. Each field is capable of holding information about one part of the event. For example, the LASTNAME field holds information about the last name of the individual who made the transaction.
The information from one or more fields of a record is used to form a key. A key is composed of one or more fields and is used to identify records in a file. The record key is usually used to make the process of retrieving records from a file easier. The key is also important for placing a file in order. Many times the records in a file will be placed in key order.
A file uses a number of different keys. The primary key is the unique identifier for each record and in a database is the physical record number of this record. If this record occupies the fifth-record location, it has the record number 5. This 5 is also the primary key for this record.
The other type of key is the secondary key. Data are usually arranged within a file in some type of order based on the contents of one or more fields known as the secondary key. For example, a file might be arranged in order by the SOCIAL SECURITY field, or it might be ordered by name. You are typically not limited to the number of keys that you wish to develop for an application.