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).

Syntax Conventions

In looking at the SQL commands, we need to establish a consistent syntax. We will employ the following conventions:

  • Uppercase words are SQL keywords, and should be typed in as written.

  • Words in italics 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.

  • The symbol ::= means "defined as” and the symbol | means ...

Get Access Database Design and Programming, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.