Databases Reference
In-Depth Information
Chapter 5. Query Languages and the Relational
Algebra
In the first part of this topic, I have tried to make a convincing argument that good
database design is important to the efficient use of a database. As you have seen, this
generally involves breaking the data up into separate pieces (tables). Of course, this
implies that we need methods for piecing the data back together again in various forms.
After all, one of the main functions of a database program is to allow the user to view the
data in a variety of ways. When data is stored in multiple tables, it is necessary to piece
the data back together to provide these various views. For instance, we might want to see
a list of all publishers that publish books priced under $10.00. This requires gathering
data from more than one table. The point is that, by breaking data into separate tables, we
must often go to the trouble of piecing the data back together in order to get a
comprehensive view of the data.
Thus, we can state the following important maxim:
As a direct consequence of good database design, we often need to use
methods for piecing data from several tables into a single coherent form.
Many database applications provide the user with relatively easy ways to create
comprehensive views of data from many tables. For instance, Microsoft Access provides
a graphical interface to create queries for that purpose. Our goal in this chapter is to
understand how a database application such as Access goes about providing this service.
The short answer to this is the following:
1. The user of a database application, such as Access, asks the application to provide
a specific view of the data by creating a query .
2. The database application then converts this query into a statement in its query
language , which in the case of Microsoft Access is Access Structured Query
Language , or Access SQL. (This is a special form of standard SQL.)
3. Finally, a special component of Access (known as the Jet Query Engine , which
we will discuss again in Chapter 7) executes the SQL statement to produce the
desired view of the data.
In view of this answer, it is time to turn away from a discussion of database-design issues
and turn toward a discussion of issues that will lead us toward database programming
and, in particular, programming in query languages such as Access SQL.
I will now outline my plan for this and the next chapter. In this chapter, I will discuss the
underlying methods involved in piecing together data from separate tables. In short, I will
discuss methods for making new tables from existing tables. This will give us a clear
understanding as to the general tasks that must be provided by a query language.
 
Search WWH ::




Custom Search