Illustration of a data model

The principal difference between information collected in a database versus information collected in a file is the way the data is organized. A flat file is organized physically; certain items precede or follow other items. But the contents of a database are organized according to a data model. A data model is a plan, or map, that defines the units of data and specifies how each unit relates to the others.

For example, a number can appear in either a file or a database. In a file, it is simply a number that occurs at a certain point in the file. A number in a database, however, has a role that the data model assigns to it. The role might be a price that is associated with a product that was sold as one item of an order that a customer placed. Each of these components, price, product, item, order, and customer, also has a role that the data model specifies. For an illustration of a data model, see the following figure.
Figure 1: The advantage of using a data model

This figure is described in the surrounding text.

You design the data model when you create the database. You then insert units of data according to the plan that the model lays out. Some books use the term schema instead of data model.