Understanding SQL
Underlying every query in Microsoft Access 2010 is the Structured Query Language (SQL) database command language. Although you can design most queries using the simple Access 2010 design grid (or the view, function, or stored procedure designer in an Access project file), Access stores every query you design as an SQL command. When you use one of the designers, Access creates the SQL for you. However, for advanced types of queries that use the results of a second query as a comparison condition, you need to know SQL to define the second query (called a subquery). Also, you cannot use the design grid to construct all types of queries available in the product; you must use SQL for some of them. Understanding SQL is essential to building queries in an Access project file, because you're using Microsoft SQL Server.
This tuorial contains two major sections: SQL select queries and SQL action queries. Within the first section, you can find keywords used in SQL in alphabetical order. You can also find entries for the basic building blocks you need to understand and use in various clauses: Column-Name, Expression, Search-Condition, and Subquery. If you're new to SQL, you might want to study these building block topics first. You can then study the major clauses of a SELECT statement in the order in which they appear in a SELECT statement: PARAMETERS, SELECT, FROM, WHERE, GROUP BY, HAVING, UNION, and ORDER BY.
In the second section, you can find a discussion of the syntax for the four types of queries that you can use to update your database, also in alphabetical order: DELETE, INSERT, SELECT INTO, and UPDATE. As you study these topics, you'll find references to some of the major clauses that you'll also use in a SELECT statement. You can find the details about those clauses in the first section.
In this tutorial:
- SQL SELECT Queries
- BETWEEN Predicate
- Comparison Predicate
- EXISTS Predicate
- Expression
- FROM Clause
- GROUP BY Clause
- HAVING Clause
- IN Clause
- IN Predicate
- LIKE Predicate
- NULL Predicate
- PARAMETERS Declaration
- Quantified Predicate
- Search Condition
- SELECT Statement
- Subquery
- TRANSFORM Statement
- UNION Query Operator
- WHERE Clause
- SQL Action Queries
- INSERT Statement (Append Query)
- SELECT . . . INTO Statement (Make-Table Query)
- UPDATE Statement