The syntax for the query specification in BNF is as follows:

Syntax

query_specification ::=
 SELECT [ ALL | DISTINCT ][top_specification]{ *
     |{table_name. |alias.}* [, {table_name.|alias.}* ] ,...
     | expr [[ AS ][ ']column_title[' ]]
      [, expr [[ AS ][ ']column_title[' ]]] ,...}
 FROM table_ref[, table_ref]...
  [ WHERE search_condition]
  [ GROUP BY [ table.]column_name[, [ table.]column_name] ,...
  [ HAVING search_condition][WITH locking_hints][order_by_specification][offset-fetch specification];