更新时间:2024-11-26 GMT+08:00
分享

SELECT

语法

[/*+ query_rewrite_hint*/]

[ WITH [ RECURSIVE ] with_query [, ...] ]

SELECT [ ALL | DISTINCT ] select_expression [, ...]

[ FROM from_item [, ...] ]

[ WHERE condition ]

[ GROUP BY [ ALL | DISTINCT ] grouping_element [, ...] ]

[ HAVING condition]

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

[ ORDER BY expression [ ASC | DESC ] [, ...] ]

[ OFFSET count [ ROW | ROWS ] ]

[ LIMIT { count | ALL } ]

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

  • from_item可以是以下形式:
    • table_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ]
    • from_item join_type from_item [ ON join_condition | USING ( join_column [, ...] ) ]
    • table_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ]

      MATCH_RECOGNIZE pattern_recognition_specification

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

  • join_type可以是以下形式:
    • [ INNER ] JOIN
    • LEFT [ OUTER ] JOIN
    • RIGHT [ OUTER ] JOIN
    • FULL [ OUTER ] JOIN
    • LEFT [SEMI] JOIN
    • RIGHT [SEMI] JOIN
    • LEFT [ANTI] JOIN
    • RIGHT [ANTI] JOIN
    • CROSS JOIN
  • grouping_element可以是以下形式:
    • ()
    • expression
    • GROUPING SETS ( ( column [, ...] ) [, ...] )
    • CUBE ( column [, ...] )
    • ROLLUP ( column [, ...] )

描述

从零个或多个表中检索行数据。

查询stu表的内容。

SELECT id,name FROM stu;

相关文档