| SQL Syntax Table | 
The PxPlus SQL ODBC Driver supports the SQL syntax described in the table below. For an illustration of this syntax, see Constructing a Left Outer Join Using the Syntax Table.
In the following table, SQL keywords are shown in uppercase, the vertical bars (pipes) "|" separate choices where more than one command is represented, and a blank indicates that no qualifier is required.
| Syntax | Description | 
| statement | SELECT select orderby | INSERT insert | DELETE delete | UPDATE update | 
| top | blank | TOP integer | 
| select | top selectcols FROM tablelist where groupby having limit hint union | 
| insert | INTO tablename insertvals | 
| delete | FROM tablename where | 
| update | tablename SET setlist where | 
| setlist | set | setlist, set | 
| set | columnname = NULL | columnname = expression | 
| insertvals | (columnlist) VALUES (valuelist) | VALUES (valuelist) | | 
| columnlist | columnname, columnlist | columnname | 
| valuelist | NULL, valuelist | expression, valuelist | expression | NULL | 
| selectcols | selectallcols * | selectallcols selectlist | 
| selectallcols | blank | ALL | DISTINCT | 
| selectlist | selectlistitem, selectlist | selectlistitem | 
| selectlistitem | expression | expression aliasname | expression AS aliasname | aliasname.* | colref | 
| where | blank | WHERE boolean | 
| having | blank | HAVING boolean | 
| limit | blank | LIMIT integer limitoffset | 
| limitoffset | blank | OFFSET integer | 
| blank | UNION select | UNION ALL select | |
| boolean | and | and OR boolean | 
| and | not | not AND and | 
| not | comparison | NOT comparison | 
| comparison | (boolean) | colref IS NULL | colref IS NOT NULL | | 
| selectop | blank | ALL | ANY | 
| op | > | >= | < | <= | = | <> | 
| pattern | string | ? | USER | 
| expression | expression + times | expression - times | times | 
| times | times * neg | times / neg | neg | 
| neg | term | + term | - term | 
| term | (expression) | colref | simpleterm | aggterm | scalar | case | 
| case | CASE when else END | 
| when | expression simplewhen | searchedwhen | 
| simplewhen | WHEN expression THEN expression | simplewhen simplewhen | 
| searchedwhen | WHEN boolean THEN expression | searchedwhen searchedwhen | 
| else | blank | ELSE expression | 
| scalar | scalarshorthand | fn | 
| scalarshorthand | {FN fn} | 
| fn | functionname (valuelist) | functionname( ) | 
| aggterm | COUNT ( * ) | AVG (expression) | MAX (expression) | | 
| simpleterm | string | realnumber | ? | USER | date | 
| groupby | blank | GROUP BY groupbyterms | 
| groupbyterms | colref | colref, groupbyterms | 
| orderby | blank | ORDER BY orderbyterms | 
| orderbyterms | orderbyterm | orderbyterm, orderbyterms | 
| orderbyterm | colref asc | integer asc | 
| asc | blank | ASC | DESC | 
| hint | blank | HINT KEY integer | 
| colref | aliasname.columnname | columnname | 
| tablelist | tablelistitem crossjointerm tablelist | tablelistitem | 
| crossjointerm | , | CROSS JOIN | 
| tablelistitem | tableref | outerjoin | 
| outerjoin | ojshorthand | oj | 
| ojshorthand | {OJ oj} | 
| inneroj | tableref innerojterm tableref ON boolean | | 
| innerojterm | INNER JOIN | JOIN | 
| oj | tableref ojterm tableref ON boolean | | 
| ojterm | LEFT OUTER JOIN | LEFT JOIN | (Support for FULL OUTER JOIN | FULL JOIN was added in PxPlus 2018.) | 
| tableref | tablename | tablename aliasname | 
| indexname | identifier | 
| functionname | identifier (see Scalar Functions) | 
| tablename | identifier | qualifier.identifier | 
| qualifier | identifier (The qualifier is ignored. The PxPlus SQL ODBC Driver does not support a data dictionary directory other than the one specified in the DSN or connection string.) (Support for qualifier was added in PxPlus 2017.) | 
| datatype | identifier | 
| columnname | identifier | 
| aliasname | identifier | 
| identifier | An identifier (must be enclosed in double quotes if it contains spaces) | 
| string | A string (enclosed in single quotes) | 
| realnumber | A non-negative real number (including E notation) | 
| integer | A non-negative integer | 
| date | dateshorthand | dateval | 
| dateshorthand | {d dateval} | 
| dateval | Date in yyyy-mm-dd format in single quotes (e.g. '1996-02-05') | 
The PxPlus SQL ODBC Driver also allows comments within SQL queries. Both block and line comments are supported. (added in PxPlus 2016)
| Block Comment: | /* This is a comment */ | 
| Line Comment: | -- This is also a comment | 
Example:
       /* This is an example SQL query with comments */
       SELECT * --Get all rows
       FROM 'Customer' --List all customers