Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagesql
--query_block
SELECT [DISTINCT] select_item [,select_item]...
FROM table_element [join element]...
[WHERE condition]
[GROUP BY expression [,expression]... [HAVING condition] ] [ORDER BY orderby_item [,orderby_item]... ]
[LIMIT row_count OFFSET row_offset]

--select_item
schema_name.]table_name.]  |  expression [ [as] alias]*

--expression (returns a value)
simple_expression    |  (expression)     | 
function(expression) |  case_expression  | 
expression [+ | - | * | /] expression

--simple_expression (returns a value) 
column_identifier  |  literal  |  NULL 

--column_identifier
[[schema_name.]table_name.]column_name 

--table_element
[schema_name.]table_name [ [as] alias]  |
(query_block) [as] alias

--join_element
[INNER | LEFT OUTER | RIGHT OUTER | FULL OUTER | CROSS] JOIN table_element ON join_condition

--join_condition (returns TRUE/FALSE/NULL)
expression <=> expression |
condition

--Condition (returns TRUE/FALSE/NULL) 
simple_condition              | 
(condition)                   | 
condition AND | OR condition  | 
NOT condition 

--simple_condition (returns TRUE/FALSE/NULL) 
expression = | != | <> | > | >= | < | <= expression | 
expression BETWEEN expression AND expression | 
expression LIKE 'string_pattern'                    | 
expression IS [NOT] NULL                            | 
column [NOT] IN ( query_block | list_of_value )

--orderby_item
expression [ASC | DESC]

...