0% found this document useful (0 votes)
28 views2 pages

(With (Recursive) : Output - Name) (, ... ) ) From - Item (, ... ) )

The document summarizes the syntax for the SELECT statement in SQL. It allows selecting data from one or more tables, views, or other data sources, filtering it by applying criteria, sorting it, and organizing and summarizing it. The SELECT statement can include clauses like WHERE, GROUP BY, HAVING, WINDOW, UNION, INTERSECT, EXCEPT, ORDER BY, LIMIT, and OFFSET to refine the query further.

Uploaded by

MAURICIO FONSECA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views2 pages

(With (Recursive) : Output - Name) (, ... ) ) From - Item (, ... ) )

The document summarizes the syntax for the SELECT statement in SQL. It allows selecting data from one or more tables, views, or other data sources, filtering it by applying criteria, sorting it, and organizing and summarizing it. The SELECT statement can include clauses like WHERE, GROUP BY, HAVING, WINDOW, UNION, INTERSECT, EXCEPT, ORDER BY, LIMIT, and OFFSET to refine the query further.

Uploaded by

MAURICIO FONSECA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

[ WITH [ RECURSIVE ] with_query [, ...

] ]

SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ]

[ * | expression [ [ AS ] output_name ] [, ...] ]

[ FROM from_item [, ...] ]

[ WHERE condition ]

[ GROUP BY grouping_element [, ...] ]

[ HAVING condition [, ...] ]

[ WINDOW window_name AS ( window_definition ) [, ...] ]

[ { UNION | INTERSECT | EXCEPT } [ ALL | DISTINCT ] select ]

[ ORDER BY expression [ ASC | DESC | USING operator ] [ NULLS { FIRST | LAST } ] [, ...] ]

[ LIMIT { count | ALL } ]

[ OFFSET start [ ROW | ROWS ] ]

[ FETCH { FIRST | NEXT } [ count ] { ROW | ROWS } ONLY ]

[ FOR { UPDATE | NO KEY UPDATE | SHARE | KEY SHARE } [ OF table_name [, ...] ] [ NOWAIT | SKIP
LOCKED ] [...] ]

where from_item can be one of:

[ ONLY ] table_name [ * ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ]

[ TABLESAMPLE sampling_method ( argument [, ...] ) [ REPEATABLE ( seed ) ] ]

[ LATERAL ] ( select ) [ AS ] alias [ ( column_alias [, ...] ) ]

with_query_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ]

[ LATERAL ] function_name ( [ argument [, ...] ] )

[ WITH ORDINALITY ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ]

[ LATERAL ] function_name ( [ argument [, ...] ] ) [ AS ] alias ( column_definition [, ...] )

[ LATERAL ] function_name ( [ argument [, ...] ] ) AS ( column_definition [, ...] )


[ LATERAL ] ROWS FROM( function_name ( [ argument [, ...] ] ) [ AS ( column_definition [, ...] ) ] [, ...] )

[ WITH ORDINALITY ] [ [ AS ] alias [ ( column_alias [, ...] ) ] ]

from_item [ NATURAL ] join_type from_item [ ON join_condition | USING ( join_column [, ...] ) ]

and grouping_element can be one of:

()

expression

( expression [, ...] )

ROLLUP ( { expression | ( expression [, ...] ) } [, ...] )

CUBE ( { expression | ( expression [, ...] ) } [, ...] )

GROUPING SETS ( grouping_element [, ...] )

and with_query is:

with_query_name [ ( column_name [, ...] ) ] AS ( select | values | insert | update | delete )

TABLE [ ONLY ] table_name [ * ]

You might also like