Another difference between a database and a file is the way you
can access them. You can search a file sequentially, looking for particular
values at particular physical locations in each line or record. That
is, you might ask, What records have the number 1013 in the first
field? The following figure shows this type of search. Figure 1. Search a file sequentially
In contrast, when you query a database, you use the terms that
the model defines. You can query the database with questions such
as, What orders have been placed for products made
by the Shimara Corporation, by customers in New Jersey, with ship
dates in the third quarter? The following figure shows this
type of query. Figure 2. Query
a database
In other words, when you access data that is stored in a file,
you must state your question in terms of the physical layout of the
file. When you query a database, you can ignore the arcane details
of computer storage and state your query in terms that reflect the
real world, at least to the extent that the data model reflects the
real world.