Skip to content

docs: function alias #2106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_position: 1

import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.371"/>
<FunctionDescription description="Introduced or updated: v1.2.738"/>

The CREATE TASK statement is used to define a new task that executes a specified SQL statement on a scheduled basis or dag based task graph.

Expand All @@ -14,7 +14,7 @@ The CREATE TASK statement is used to define a new task that executes a specified
## Syntax

```sql
CREATE TASK [ IF NOT EXISTS ] <name>
CREATE [ OR REPLACE ] TASK [ IF NOT EXISTS ] <name>
WAREHOUSE = <string>
SCHEDULE = { <num> MINUTE | <num> SECOND | USING CRON <expr> <time_zone> }
[ AFTER <string> [ , <string> , ... ]]
Expand Down
11 changes: 5 additions & 6 deletions docs/en/sql-reference/10-sql-commands/10-dml/dml-insert-multi.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,12 @@ SELECT ...

| Parameter | Description |
| ---------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| OVERWRITE | Indicates whether existing data should be truncated before insertion. |
| `OVERWRITE` | Indicates whether existing data should be truncated before insertion. |
| `( <target_col_name> [ , ... ] )` | Specifies the column names in the target table where data will be inserted.<br/>- If omitted, data will be inserted into all columns in the target table. |
| VALUES `( <source_col_name> [ , ... ] )` | Specifies the source column names from which data will be inserted into the target table.<br/>- If omitted, all columns returned by the subquery will be inserted into the target table.<br/>- The data types of the columns listed in `<source_col_name>` must match or be compatible with those specified in `<target_col_name>`. |
| SELECT ... | A subquery that provides the data to be inserted into the target table(s).<br/>- You have the option to explicitly assign aliases to columns within the subquery. This allows you to reference the columns by their aliases within WHEN clauses and VALUES clauses. |
| WHEN | Conditional statement to determine when to insert data into specific target tables.<br/>- A conditional multi-table insert requires at least one WHEN clause.<br/>- A WHEN clause can include multiple INTO clauses, and these INTO clauses can target the same table.<br/>- To unconditionally execute a WHEN clause, you can use `WHEN 1 THEN ...`. |
| ELSE | Specifies the action to take if none of the conditions specified in the WHEN clauses are met. |

| `VALUES ( <source_col_name> [ , ... ] )` | Specifies the source column names from which data will be inserted into the target table.<br/>- If omitted, all columns returned by the subquery will be inserted into the target table.<br/>- The data types of the columns listed in `<source_col_name>` must match or be compatible with those specified in `<target_col_name>`. |
| `SELECT ...` | A subquery that provides the data to be inserted into the target table(s).<br/>- You have the option to explicitly assign aliases to columns within the subquery. This allows you to reference the columns by their aliases within WHEN clauses and VALUES clauses. |
| `WHEN` | Conditional statement to determine when to insert data into specific target tables.<br/>- A conditional multi-table insert requires at least one WHEN clause.<br/>- A WHEN clause can include multiple INTO clauses, and these INTO clauses can target the same table.<br/>- To unconditionally execute a WHEN clause, you can use `WHEN 1 THEN ...`. |
| `ELSE` | Specifies the action to take if none of the conditions specified in the WHEN clauses are met. |
## Important Notes

- Aggregate functions, external UDFs, and window functions are not allowed in the `VALUES(...)` expressions.
Expand Down
13 changes: 8 additions & 5 deletions docs/en/sql-reference/10-sql-commands/10-dml/dml-insert.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: INSERT
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Inserts one or more rows into a table.

Expand All @@ -13,7 +16,7 @@ See also: [INSERT (multi-table)](dml-insert-multi.md)
## Syntax

```sql
INSERT { OVERWRITE | INTO } <table>
INSERT { OVERWRITE [ INTO ] | INTO } <table>
-- Optionally specify the columns to insert into
( <column> [ , ... ] )
-- Insertion options:
Expand All @@ -25,10 +28,10 @@ INSERT { OVERWRITE | INTO } <table>
}
```

| Parameter | Description |
|-----------|----------------------------------------------------------------------------------|
| OVERWRITE | Indicates whether existing data should be truncated before insertion. |
| VALUES | Allows direct insertion of specific values or the default values of the columns. |
| Parameter | Description |
|--------------------|----------------------------------------------------------------------------------|
| `OVERWRITE [INTO]` | Indicates whether existing data should be truncated before insertion. |
| `VALUES` | Allows direct insertion of specific values or the default values of the columns. |

## Important Notes

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: GREATEST_IGNORE_NULLS
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Returns the maximum value from a set of values, ignoring any NULL values.

See also: [GREATEST](greatest.md)

## Syntax

```sql
GREATEST_IGNORE_NULLS(<value1>, <value2> ...)
```

## Examples

```sql
SELECT GREATEST_IGNORE_NULLS(5, 9, 4), GREATEST_IGNORE_NULLS(5, 9, null);
```

```sql
┌────────────────────────────────────────────────────────────────────┐
│ greatest_ignore_nulls(5, 9, 4) │ greatest_ignore_nulls(5, 9, NULL) │
├────────────────────────────────┼───────────────────────────────────┤
│ 9 │ 9 │
└────────────────────────────────────────────────────────────────────┘
```
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---
title: GREATEST
---
import FunctionDescription from '@site/src/components/FunctionDescription';

Returns the maximum value from a set of values.
<FunctionDescription description="Introduced or updated: v1.2.738"/>

Returns the maximum value from a set of values. If any value in the set is `NULL`, the function returns `NULL`.

See also: [GREATEST_IGNORE_NULLS](greatest-ignore-nulls.md)

## Syntax

Expand All @@ -13,11 +18,13 @@ GREATEST(<value1>, <value2> ...)
## Examples

```sql
SELECT GREATEST(5, 9, 4);
SELECT GREATEST(5, 9, 4), GREATEST(5, 9, null);
```

┌───────────────────┐
│ greatest(5, 9, 4) │
├───────────────────┤
│ 9 │
└───────────────────┘
```sql
┌──────────────────────────────────────────┐
│ greatest(5, 9, 4) │ greatest(5, 9, NULL) │
├───────────────────┼──────────────────────┤
│ 9 │ NULL │
└──────────────────────────────────────────┘
```
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
---
title: IF
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

If `<cond1>` is TRUE, it returns `<expr1>`. Otherwise if `<cond2>` is TRUE, it returns `<expr2>`, and so on.

Expand All @@ -10,6 +13,10 @@ If `<cond1>` is TRUE, it returns `<expr1>`. Otherwise if `<cond2>` is TRUE, it r
IF(<cond1>, <expr1>, [<cond2>, <expr2> ...], <expr_else>)
```

## Aliases

- [IFF](iff.md)

## Examples

```sql
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: IFF
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Alias for [IF](if.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: LEAST_IGNORE_NULLS
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Returns the maximum value from a set of values, ignoring any NULL values.

See also: [LEAST](least.md)

## Syntax

```sql
LEAST_IGNORE_NULLS(<value1>, <value2> ...)
```

## Examples

```sql
SELECT LEAST_IGNORE_NULLS(5, 9, 4), LEAST_IGNORE_NULLS(5, 9, null);
```

```sql
┌──────────────────────────────────────────────────────────────┐
│ least_ignore_nulls(5, 9, 4) │ least_ignore_nulls(5, 9, NULL) │
├─────────────────────────────┼────────────────────────────────┤
│ 4 │ 5 │
└──────────────────────────────────────────────────────────────┘
```
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
---
title: LEAST
---
import FunctionDescription from '@site/src/components/FunctionDescription';

Returns the minimum value from a set of values.
<FunctionDescription description="Introduced or updated: v1.2.738"/>

Returns the minimum value from a set of values. If any value in the set is `NULL`, the function returns `NULL`.

See also: [LEAST_IGNORE_NULLS](least-ignore-nulls.md)

## Syntax

Expand All @@ -13,11 +18,13 @@ LEAST(<value1>, <value2> ...)
## Examples

```sql
SELECT LEAST(5, 9, 4);
SELECT LEAST(5, 9, 4), LEAST(5, 9, null);
```

┌────────────────┐
│ least(5, 9, 4) │
├────────────────┤
│ 4 │
└────────────────┘
```
┌────────────────────────────────────┐
│ least(5, 9, 4) │ least(5, 9, NULL) │
├────────────────┼───────────────────┤
│ 4 │ NULL │
└────────────────────────────────────┘
```
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
---
title: COVAR_POP
---
import FunctionDescription from '@site/src/components/FunctionDescription';

COVAR_POP returns the population covariance of a set of number pairs.
<FunctionDescription description="Introduced or updated: v1.2.738"/>

Returns the population covariance of a set of number pairs.

## Syntax

Expand All @@ -17,6 +20,11 @@ COVAR_POP(<expr1>, <expr2>)
| `<expr1>` | Any numerical expression |
| `<expr2>` | Any numerical expression |

## Aliases

- [VAR_POP](aggregate-var-pop.md)
- [VARIANCE_POP](aggregate-variance-pop.md)

## Return Type

float64
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@
title: COVAR_SAMP
---

Aggregate function.
import FunctionDescription from '@site/src/components/FunctionDescription';

The covar_samp() function returns the sample covariance (Σ((x - x̅)(y - y̅)) / (n - 1)) of two data columns.
<FunctionDescription description="Introduced or updated: v1.2.738"/>

Returns the sample covariance (Σ((x - x̅)(y - y̅)) / (n - 1)) of two data columns.

:::caution
NULL values are not counted.
Expand All @@ -23,6 +25,11 @@ COVAR_SAMP(<expr1>, <expr2>)
| `<expr1>` | Any numerical expression |
| `<expr2>` | Any numerical expression |

## Aliases

- [VAR_SAMP](aggregate-var-samp.md)
- [VARIANCE_SAMP](aggregate-variance-samp.md)

## Return Type

float64, when `n <= 1`, returns +∞.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: VAR_POP
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Alias for [COVAR_POP](aggregate-covar-pop.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: VAR_SAMP
---

import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Alias for [COVAR_SAMP](aggregate-covar-samp.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: VARIANCE_POP
---
import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Alias for [COVAR_POP](aggregate-covar-pop.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: VARIANCE_SAMP
---

import FunctionDescription from '@site/src/components/FunctionDescription';

<FunctionDescription description="Introduced or updated: v1.2.738"/>

Alias for [COVAR_SAMP](aggregate-covar-samp.md).
Loading