This is an automated email from the ASF dual-hosted git repository.

jark pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git

commit 091d756065696f0dc075c0acf0b6f9291afc666b
Author: luoyuxia <[email protected]>
AuthorDate: Mon Aug 29 15:16:54 2022 +0800

    [FLINK-29025][docs] add sub query page for Hive dialect
---
 .../hiveDialect/Queries/sub-queries.md             | 69 ++++++++++++++++++++++
 .../hiveDialect/Queries/sub-queries.md             | 69 ++++++++++++++++++++++
 2 files changed, 138 insertions(+)

diff --git 
a/docs/content.zh/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sub-queries.md
 
b/docs/content.zh/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sub-queries.md
new file mode 100644
index 00000000000..592d130bf46
--- /dev/null
+++ 
b/docs/content.zh/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sub-queries.md
@@ -0,0 +1,69 @@
+---
+title: "Sub-Queries"
+weight: 8
+type: docs
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+  http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Sub-Queries
+
+## Sub-Queries in the FROM Clause
+
+### Description
+
+Hive dialect supports sub-queries in the `FROM` clause. The sub-query has to 
be given a name because every table in a `FROM` clause must have a name.
+Columns in the sub-query select list must have unique names.
+The columns in the sub-query select list are available in the outer query just 
like columns of a table.
+The sub-query can also be a query expression with `UNION`. Hive dialect 
supports arbitrary levels of sub-queries.
+
+### Syntax
+
+```sql
+select_statement from ( subquery_select_statement ) [ AS ] name
+```
+
+### Example
+
+```sql
+SELECT col
+FROM (
+  SELECT a+b AS col
+  FROM t1
+) t2
+```
+
+## Sub-Queries in the WHERE Clause
+
+### Description
+
+Hive dialect also supports some types of sub-queries in the `WHERE` clause.
+
+### Syntax
+
+```sql
+select_statement from table WHERE { colName { IN | NOT IN } 
+                                  | NOT EXISTS | EXISTS } ( 
subquery_select_statement )
+```
+
+### Examples
+
+```sql
+SELECT * FROM t1 WHERE t1.x IN (SELECT y FROM t2);
+ 
+SELECT * FROM t1 WHERE EXISTS (SELECT y FROM t2 WHERE t1.x = t2.x);
+```
diff --git 
a/docs/content/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sub-queries.md
 
b/docs/content/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sub-queries.md
new file mode 100644
index 00000000000..592d130bf46
--- /dev/null
+++ 
b/docs/content/docs/dev/table/hiveCompatibility/hiveDialect/Queries/sub-queries.md
@@ -0,0 +1,69 @@
+---
+title: "Sub-Queries"
+weight: 8
+type: docs
+---
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+  http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+# Sub-Queries
+
+## Sub-Queries in the FROM Clause
+
+### Description
+
+Hive dialect supports sub-queries in the `FROM` clause. The sub-query has to 
be given a name because every table in a `FROM` clause must have a name.
+Columns in the sub-query select list must have unique names.
+The columns in the sub-query select list are available in the outer query just 
like columns of a table.
+The sub-query can also be a query expression with `UNION`. Hive dialect 
supports arbitrary levels of sub-queries.
+
+### Syntax
+
+```sql
+select_statement from ( subquery_select_statement ) [ AS ] name
+```
+
+### Example
+
+```sql
+SELECT col
+FROM (
+  SELECT a+b AS col
+  FROM t1
+) t2
+```
+
+## Sub-Queries in the WHERE Clause
+
+### Description
+
+Hive dialect also supports some types of sub-queries in the `WHERE` clause.
+
+### Syntax
+
+```sql
+select_statement from table WHERE { colName { IN | NOT IN } 
+                                  | NOT EXISTS | EXISTS } ( 
subquery_select_statement )
+```
+
+### Examples
+
+```sql
+SELECT * FROM t1 WHERE t1.x IN (SELECT y FROM t2);
+ 
+SELECT * FROM t1 WHERE EXISTS (SELECT y FROM t2 WHERE t1.x = t2.x);
+```

Reply via email to