Definitions

The basic unit of information in a database is a columnClosed A column is a set of data values, all of a single type, in a table.. A column (or data field) is an item of data with attributes such as name, type (for example, a character or an integer), and length. Examples of columns are employee name, date of birth, social security number, inventory item code, and serial number. Other database systems, books or other publications may use other terms (such as attribute, entity, or field) for column.

A tableClosed Tables are database objects that contain all the data in a database. In tables, data is logically organized in a row-and-column format similar to a spreadsheet. Each row represents a unique record, and each column represents a field in the record. is a named collection of related columns, which are stored and accessed as a unit. Other database systems, books or other publications may use other terms (such as record or file) for table. For example, a table named register in a checking account database may have the following columns:

date
check number 
paid to 
amount 

Each row (or instance) in the register table in the database contains a value for each of these columns. In the C/C++ API, the definition of a table can be represented as a C-structure.

A key (or index) is an attribute of a column through which rapid or sorted access to the rows in a table is possible. In the register table, you might define the check number as a key column to allow quick retrieval of a register table row through specification of a check number.

An index is a file containing only keys. It is synonymously referred to as a key file. The index to this manual demonstrates the features of a key file: the individual subject entries in the index are the "keys," while the page where the subject is discussed is analogous to the associated "records." You can find the page that discusses a desired subject much more quickly by using the index than by reading through each page. And, because the keys are sorted in the index, you can quickly find a specific key. Key files are similar, except the computer does the sorting and look-ups for you. To maintain its key files, RaimaDB uses the B-tree method, one of the most efficient techniques for implementing an index.

In a key scan operation, the keys in an index are read in the order they appear. Key scans are used to produce sorted listings of records and for fast search operations requiring inspection of a large number of record occurrences (for example, retrieving all checks entered between two dates).

Data relationships often exist between tables in the database. For example, the checking account database may include budget categories. A second table named budget could be defined with the following data fields:

budget code (a key field)
category description 
monthly allocation 
balance 

To associate a particular budget category with each register table row, we add a budget code field to the check record type, forming a relationship between the budget table and the register table. Whenever a check is entered, the related budget table is located via the budget code, and the balance for that budget is updated by the amount specified in the register table row.

The schemaClosed A database schema defines how data is organized within a database; this is inclusive of logical constraints such as, table names, fields, data types, and the relationships between these entities. is the conceptual definition of the content and organization of a database. A schema will include the definitions of all tables, with their columns and keys. The form of the schema used by the DBMS is called the catalog. In RaimaDB (and most other DBMSs) a Database Definition Language, or DDL, specifies the schema. A RaimaDB DDL specification for the checking account database is shown below. The specifics of the actual DDL statements are explained in the Schema Creation section.

create table budget (
    budget_code   char(6) primary key,
    category_desc char(48),
    allocation    double,
    balance       double
);

create table register (
    check_no      integer primary key,
    check_date    date,
    budget_code   char(6),
    payee         char(48),
    amount        double
);

A data model (or database model) is a conceptual representation of inter-record relationships. The relational database model establishes and maintains inter-record relationships through common data fields. For example, in the checking account example a common data field, budget_code, establishes the relationship between the budget table and the register table.

Other database models, in particular the network database model, establish inter-record relationships directly, through physical links between the related records, rather than through common data fields. These models are discussed in the following sections. Since RaimaDB supports both the relational and the network database models, you can combine the features of these models to meet the needs of your particular application.