Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4687 from BohuTANG/doc-round3-not-in
chore(doc): add in conditional function and subquery operator
- Loading branch information
Showing
16 changed files
with
159 additions
and
24 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
docs/doc/03-reference/02-functions/01-conditional-functions/in.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
title: IN | ||
description: Tests whether the argument is or is not one of the members of an explicit list | ||
--- | ||
|
||
Tests whether the argument is or is not one of the members of an explicit list. | ||
|
||
## Syntax | ||
|
||
```sql | ||
<value> [ NOT ] IN ( <value1> , <value2> , ... ) | ||
``` | ||
|
||
## Arguments | ||
|
||
| Arguments | Description | | ||
| ----------- | ----------- | | ||
|
||
## Return Type | ||
|
||
|
||
## Examples | ||
|
||
```sql | ||
mysql> select * from numbers(10) where number in (0, 1, 2, 3); | ||
+--------+ | ||
| number | | ||
+--------+ | ||
| 0 | | ||
| 1 | | ||
| 2 | | ||
| 3 | | ||
+--------+ | ||
|
||
mysql> select * from numbers(10) where number not in (0, 1, 2, 3); | ||
+--------+ | ||
| number | | ||
+--------+ | ||
| 4 | | ||
| 5 | | ||
| 6 | | ||
| 7 | | ||
| 8 | | ||
| 9 | | ||
+--------+ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "DML Commands", | ||
"link": { | ||
"type": "generated-index", | ||
"slug": "/reference/sql/dml" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "Query Syntax", | ||
"link": { | ||
"type": "generated-index", | ||
"slug": "/reference/sql/query-syntax" | ||
} | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
docs/doc/03-reference/03-sql/04-query-operators/_category_.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "Query Operators", | ||
"link": { | ||
"type": "generated-index", | ||
"slug": "/reference/sql/query-operators" | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
docs/doc/03-reference/03-sql/04-query-operators/operators-subquery.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
title: Subquery Operators | ||
description: | ||
A subquery is a query nested within another query. | ||
--- | ||
|
||
This topic provides reference information about the subquery operators supported in Databend. | ||
|
||
A subquery is a query nested within another query. | ||
|
||
## [ NOT ] EXISTS | ||
|
||
An EXISTS subquery is a boolean expression that can appear in a WHERE clause: | ||
* An EXISTS expression evaluates to TRUE if any rows are produced by the subquery. | ||
* A NOT EXISTS expression evaluates to TRUE if no rows are produced by the subquery. | ||
|
||
### Syntax | ||
|
||
```sql | ||
[ NOT ] EXISTS ( <query> ) | ||
``` | ||
|
||
:::note | ||
* Correlated EXISTS subqueries are currently supported only in a WHERE clause. | ||
::: | ||
|
||
### Example | ||
|
||
```sql | ||
mysql> select number from numbers(10) where number>5 and exists(select number from numbers(5) where number>4); | ||
Query OK, 0 rows affected | ||
``` | ||
`select number from numbers(5) where number>4` no rows are produced, `exists(select number from numbers(5) where number>4)` is FALSE. | ||
|
||
```sql | ||
mysql> select number from numbers(10) where number>5 and exists(select number from numbers(5) where number>3); | ||
+--------+ | ||
| number | | ||
+--------+ | ||
| 6 | | ||
| 7 | | ||
| 8 | | ||
| 9 | | ||
+--------+ | ||
``` | ||
|
||
`EXISTS(SELECT NUMBER FROM NUMBERS(5) WHERE NUMBER>3)` is TRUE. | ||
|
||
```sql | ||
mysql> select number from numbers(10) where number>5 and not exists(select number from numbers(5) where number>4); | ||
+--------+ | ||
| number | | ||
+--------+ | ||
| 6 | | ||
| 7 | | ||
| 8 | | ||
| 9 | | ||
+--------+ | ||
``` | ||
|
||
`not exists(select number from numbers(5) where number>4)` is TRUE. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "SHOW Commands", | ||
"link": { | ||
"type": "generated-index", | ||
"slug": "/reference/sql/show" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "KILL Commands", | ||
"link": { | ||
"type": "generated-index", | ||
"slug": "/reference/sql/kill" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "LIST Commands", | ||
"link": { | ||
"type": "generated-index", | ||
"slug": "/reference/sql/list" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
docs/doc/03-reference/03-sql/07-system-tables/_category_.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"label": "System Tables", | ||
"link": { | ||
"type": "generated-index", | ||
"slug": "/reference/sql/system-tables" | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
32114a6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: