Databases Reference
In-Depth Information
Despite these important reasons, we suggest that, on first reading, you go lightly over the
SQL commands to get a flavor for how they work. Then you can use this chapter as a
reference whenever you actually need to write SQL statements yourself. Fortunately,
SQL has relatively few actual commands, which makes it easy to get an overall picture of
the language. (For instance, SQL is single-statement oriented. It does not have control
structures such as For...Next... loops, nor conditional statements such as If...Then...
statements.)
We should also mention that using the Query Design Window itself is a good way to
learn SQL, for you can create a query in the Design Window and then switch to SQL
View to see the corresponding SQL statement, obligingly created by Microsoft Access.
6.5 Access SQL
SQL is a nonprocedural language, meaning, as we have seen, that expressions in SQL
state what needs to be done, but not how it should be done. This frees the programmer to
concentrate on the logic of the SQL program. The Access Query Engine takes care of
optimization.
One way to experiment with SQL is to enter a query using Design View and then switch
to SQL View to see how Access resolves the query into SQL. It is also worth mentioning
that the Help system has complete details on the syntax and options of each SQL
statement.
Incidentally, reading the definition of SQL statements can be tiresome. You may wish to
just skim over the syntax of each statement and go directly to the examples. The main
goal here is to get a reasonable feel for SQL statements and what they can do. You can
then look up the correct syntax for the relevant statement when needed (as I do).
6.5.1 Syntax Conventions
In looking at the SQL commands, we need to establish a consistent syntax. I will employ
the following conventions:
Uppercase words are SQL keywords and should be typed in as written.
Words in constant width italic are intended to be replaced with something else.
For instance, in the statement:
CREATE TABLE TableName
we must replace TableName with the name of a table.
An item in square brackets [ ] is optional.
Braces ({}) are used to (hopefully) clarify the syntax. They are never to be
included in the statement proper.
Parentheses should be typed as shown.
 
Search WWH ::




Custom Search