How data is stored in a database

The data in a database is grouped into a series of database records. Each database record is composed of smaller groups of data called segments. A segment is the smallest piece of data IMS™ can store. Segments, in turn, are made up of one or more fields.

The following figure shows a record in a school database. Each of the boxes is a segment or separate group of data in the database record. The segments in the database record contain the following information:
COURSE
The name of the course
INSTR
The name of the teacher of the course
REPORT
A report the teacher needs at the end of the course
STUDENT
The names of students in the course
GRADE
The grade a student received in the course
PLACE
The room in which the course is taught
Figure 1. Segment types in the school database record
COURSE is the root segment and the parent of the three segments below it: INSTR, STUDENT, and PLACE. Below INSTR is REPORT. Below STUDENT is GRADE.

The segments within a database record exist in a hierarchy. A hierarchy is the order in which segments are arranged. The order implies something. The school database is storing data about courses that are taught. The COURSE segment is at the top of the hierarchy. The other types of data in segments in the database record would be meaningless if there was no COURSE.