(Contents)(Next)

Expanding the Sample

The examples of SQL statements used so far were based on the table 'customer'. They dealt with restrictions for this table and the formatting of the output (reordering, headings, and the like).

This sample is expanded in the following by three tables, 'hotel', 'room', and 'reservation', in order to represent more complex calculations and interrelations of several tables. The way of putting the questions is simplified. The questions themselves could come from the activities of a travel agency.

The table 'hotel' describes various hotels and their addresses. The hotels are identified by a unique number.

The table 'room' contains both the particular prices for rooms of different sizes and the total number of rooms available for this category. The association of the rooms with the hotels is ensured by the hotel number.

In the table 'reservation', at last, it is recorded which customer made a reservation in which hotel for which category of room. Thus a logical relation between the tables 'customer', 'hotel', and 'room' is established. The entries are provided with unique numbers for identification purposes.

The complete definition of the tables is included in Section The Tables Used.


(Contents)(Next)