Home | Previous Page | Next Page   Database Concepts > Illustration of a Data Model >

Querying Data

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?" Figure 2 shows this type of search.

Figure 2. Searching a File Sequentially
begin figure description - This figure is described in the surrounding text. - end figure description

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?" Figure 3 shows this type of query.

Figure 3. Querying a Database
begin figure description - This figure is described in the surrounding text. - end figure description

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.

Composing SELECT Statements, and Composing Advanced SELECT Statements, discuss the language you use to make queries.

For information about how to build and implement your data model, see the IBM Informix: Database Design and Implementation Guide.

Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]