Databases Reference
In-Depth Information
Parameter query
For select or crosstab queries, we may choose to let the user supply certain data at
runtime by filling in a dialog box. This can be done in both Design View and SQL
View. When the query asks for information from the user, it is referred to as a
parameterized query , or parameter query .
Table 6-1. A CROSSTAB Query
Price
Total
Big House
Medium House
Small House
$ 12.00
1
1
$13.00
3
2
1
$ 15.00
1
1
$18.00
1
1
$ 20.00
6
1
5
$25.00
2
2
$ 34.00
5
1
4
$44.00
1
1
$ 49.00
6
1
4
1
$99.00
1
1
Finally, I mention that Access allows a select or action query to contain another select
query. This is done by nesting SQL SELECT statements, as we will see. The internal
query is called a subquery of the external query. Access allows multiple levels of
subqueries.
6.4 Why Use SQL?
As you look through the syntax of the SQL statements in this chapter, you may be struck
by the fact that SQL is not a particularly pleasant language. Moreover, as I have said,
many features of SQL can be accessed through the Access Query Design Window. So
why program in SQL at all?
Here are some reasons:
There are some important features of SQL that cannot be reached through the
Query Design Window. For instance, there is no way to create a union query, a
subquery, or an SQL pass-through query (which is a query that passes through
Access to an external database server, such as Microsoft SQL Server) using the
Query Design Window.
You cannot use the DDL component of SQL from within the Query Design
Window. To use this component, you must write SQL statements directly.
SQL can be used from within other applications, such as Microsoft Excel, Word,
and Visual Basic, to run the Access SQL engine.
SQL is an industry-standard language for querying databases, and as such it is
useful outside of the Microsoft Access environment.
 
Search WWH ::




Custom Search