SQL Reference
Table Of Contents
- Chapter 1 Introduction
- Chapter 2 Supported standards
- Support for Unicode characters
- SQL statements
- SELECT statement
- SQL clauses
- FROM clause
- WHERE clause
- GROUP BY clause
- HAVING clause
- UNION operator
- ORDER BY clause
- OFFSET and FETCH FIRST clauses
- FOR UPDATE clause
- DELETE statement
- INSERT statement
- UPDATE statement
- CREATE TABLE statement
- TRUNCATE TABLE statement
- ALTER TABLE statement
- CREATE INDEX statement
- DROP INDEX statement
- SQL expressions
- SQL functions
- FileMaker system objects
- Reserved SQL keywords
- Index
Chapter 2 | Supported standards 9
SQL clauses
The ODBC and JDBC client drivers provide support for the following SQL clauses.
Use this SQL clause To
FROM (page 9) Indicate which tables are used in the SELECT statement.
WHERE (page 10) Specify the conditions that records must mee
t to be retrieved (like a FileMaker Pro find
request).
GROUP BY (page 11) Specify the names of one or more fields by which the returned valu
es should be grouped.
This clause is used to return a set of aggregate values by returning one row for each group
(like a FileMaker Pro subsummary).
HAVING (page 11) Specify conditions for group
s of records (for example, display only the departments that
have salaries totaling more than $200,000).
UNION (page 12) Combine the results of two or more SELECT
statements into a single result.
ORDER BY (page 12) Indicate how the records are sorted.
OFFSET (page 13) State the number of rows to be skipped before starting to retrieve rows.
FETCH FIRST (page 13) Specify the number of rows to be retrieved. No more than the specified
number of rows are
returned although fewer rows may be returned if the query yields less than the number of
rows specified.
FOR UPDATE (page 14) Perform Positioned Updates or Positione
d Deletes via SQL cursors.
Note If you attempt to retrieve data from a table with no columns, the SELECT statement returns
nothing.
FROM clause
The FROM clause indicates the tables that are used in the SELECT statement. The format is:
FROM table_name [table_alias] [, table_name [table_alias]]
table_name
is the name of a table in the current database. The table name must begin with an
alphabetic character. If the table name begins with other than an alphabetic character, enclose it
in double quotation marks (quoted identifier).
table_alias
can be used to give the table a more descriptive name, to abbreviate a longer table
name, or to include the same table in the query more than once (for example, in self-joins).
Field names begin with an alphabetic character. If the field name beg
ins with other than an
alphabetic character, enclose it in double quotation marks (quoted identifier). For example, the
ExecuteSQL statement for the field named _LASTNAME is:
SELECT "_LASTNAME" from emp
Field names can be prefixed with the table name or the table alias. Fo
r example, given the table
specification FROM employee E, you can refer to the LAST_NAME field as E.LAST_NAME. Table
aliases must be used if the SELECT statement joins a table to itself. For example:
SELECT * FROM employee E, employee F WHERE E.manager_id =
F.e
mployee_id
The equal sign (=) includes only matching rows in the results.