Database Models
The Network Database Model
In the network database model, the relationships between record types are explicitly defined and directly maintained through sets. A set defines a one-to-many relationship between two record types. Examples of sets are:
- one baseball league has many teams
- one baseball team has many players
Sets are implemented with linked lists of pointers to the record locations of the set members and owners. The result is a network of interconnected records.
The illustration below shows the set relationships for the baseball example. The boxes represent instances of the league, team, and player record types. The arrows represent the links that connect the related records.
Using the previous schema example from the Definitions section, the following schema can be revised to define the relationship between the register and budget table:
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
);
To the above schema definition, adding a REFERENCES clause in the register table adds additional validation that a correct code is being selected when new check record data is inserted into the register table. The new schema is below:
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) references budget,
payee char(48),
amount double
);
The Relational Database Model
The relational database model views the database as a set of two-dimensional tables (or relations). The columns (also called attributes) of a table correspond to data fields, and the rows of the table correspond to record occurrences. This tabular view of a database is particularly easy to manipulate with standard relational database operations, which are based on mathematical set theory.
In the relational model, relationships between tables are usually established through
common data fields. Recall from the initial checking account example that the relationship between the budget and register tables was formed by including in the check record
a budget code field to identify the budget category.
The principal distinction between the relational and network models is that in the relational model, relationships are formed through common data fields between the related tables, while in the network model those relationships are defined directly.