Skip to content

Commit 38783e8

Browse files
authored
chore: add some function doc (#2445)
regexp_split_to_table/array age date_add trunc
1 parent 1065015 commit 38783e8

File tree

8 files changed

+345
-25
lines changed

8 files changed

+345
-25
lines changed

โ€Ždocs/en/sql-reference/20-sql-functions/04-numeric-functions/index.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ This page provides a comprehensive overview of Numeric functions in Databend, or
2020

2121
## Rounding and Truncation Functions
2222

23-
| Function | Description | Example |
24-
|----------|-------------|---------|
25-
| [ROUND](round.md) | Rounds a number to specified decimal places | `ROUND(123.456, 2)` โ†’ `123.46` |
26-
| [FLOOR](floor.md) | Returns the largest integer not greater than the argument | `FLOOR(123.456)` โ†’ `123` |
27-
| [CEIL](ceil.md) / [CEILING](ceiling.md) | Returns the smallest integer not less than the argument | `CEIL(123.456)` โ†’ `124` |
28-
| [TRUNCATE](truncate.md) | Truncates a number to specified decimal places | `TRUNCATE(123.456, 1)` โ†’ `123.4` |
23+
| Function | Description | Example |
24+
|-----------------------------------------|-----------------------------------------------------------|----------------------------------|
25+
| [ROUND](round.md) | Rounds a number to specified decimal places | `ROUND(123.456, 2)` โ†’ `123.46` |
26+
| [FLOOR](floor.md) | Returns the largest integer not greater than the argument | `FLOOR(123.456)` โ†’ `123` |
27+
| [CEIL](ceil.md) / [CEILING](ceiling.md) | Returns the smallest integer not less than the argument | `CEIL(123.456)` โ†’ `124` |
28+
| [TRUNCATE](truncate.md) | Truncates a number to specified decimal places | `TRUNCATE(123.456, 1)` โ†’ `123.4` |
29+
| [TRUNC](trunc.md) | Truncates a number to specified decimal places | `TRUNC(123.456, 1)` โ†’ `123.4` |
2930

3031
## Exponential and Logarithmic Functions
3132

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: TRUNC
3+
---
4+
import FunctionDescription from '@site/src/components/FunctionDescription';
5+
6+
<FunctionDescription description="Introduced or updated: v1.2.756"/>
7+
8+
Returns the number `x`, truncated to `d` decimal places. If `d` is 0, the result has no decimal point or fractional part. `d` can be negative to cause `d` digits left of the decimal point of the value `x` to become zero. The maximum absolute value for `d` is 30; any digits in excess of 30 (or -30) are truncated.
9+
10+
If only provide `x` the default value of `d` is 0.
11+
12+
## Syntax
13+
14+
```sql
15+
TRUNC( x [, d] )
16+
```
17+
18+
## Examples
19+
20+
```sql
21+
SELECT TRUNC(1.223, 1);
22+
23+
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
24+
โ”‚ truncate(1.223, 1) โ”‚
25+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
26+
โ”‚ 1.2 โ”‚
27+
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
28+
29+
SELECT TRUNC(1.223)
30+
31+
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
32+
โ”‚ truncate(1.223) โ”‚
33+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
34+
โ”‚ 1 โ”‚
35+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
36+
37+
```
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
---
2+
title: AGE
3+
---
4+
import FunctionDescription from '@site/src/components/FunctionDescription';
5+
6+
<FunctionDescription description="Introduced or updated: v1.2.756"/>
7+
8+
The age() function calculates the difference between two timestamps or the difference between a timestamp and the current date and time.
9+
10+
## Syntax
11+
12+
```sql
13+
AGE(<end_timestamp>, <start_timestamp>)
14+
```
15+
16+
| Parameter | Description |
17+
|----------------------|-----------------------------------------------------------------------------|
18+
| `<end_timestamp>` | The ending timestamp |
19+
| `<start_timestamp>` | The starting timestamp |
20+
21+
## Return Type
22+
23+
Returns an INTERVAL type
24+
25+
## Calculation Logic
26+
27+
The function calculates:
28+
1. Full year differences (accounting for leap years)
29+
2. Remaining month differences (considering varying month lengths)
30+
3. Remaining day differences (including time components)
31+
32+
Negative intervals are returned when `<end_timestamp>` is earlier than `<start_timestamp>`.
33+
34+
## Examples
35+
36+
### Basic Age Calculation
37+
```sql
38+
SELECT AGE('2023-03-15'::TIMESTAMP, '2020-01-20'::TIMESTAMP);
39+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
40+
โ”‚ 3 years 1 month 26 days โ”‚
41+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
42+
```
43+
44+
### Reverse Chronology
45+
```sql
46+
SELECT AGE('2018-12-25'::TIMESTAMP, '2022-05-10'::TIMESTAMP);
47+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
48+
โ”‚ -3 years -4 months -16 days โ”‚
49+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
50+
```
51+
52+
### With Time Components
53+
```sql
54+
SELECT AGE('2023-02-28 14:00:00'::TIMESTAMP, '2023-02-27 08:30:00'::TIMESTAMP);
55+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
56+
โ”‚ 1 day 5:30:00 โ”‚
57+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
58+
```
59+
60+
### Table Data Processing
61+
```sql
62+
CREATE TABLE projects (
63+
name String,
64+
start_date TIMESTAMP,
65+
end_date TIMESTAMP
66+
);
67+
68+
INSERT INTO projects VALUES
69+
('Alpha', '2020-06-01', '2023-09-30'),
70+
('Beta', '2022-01-15', '2022-11-01');
71+
72+
SELECT
73+
name,
74+
AGE(end_date, start_date) AS duration
75+
FROM projects;
76+
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
77+
โ”‚ name โ”‚ duration โ”‚
78+
โ”‚ Nullable(String) โ”‚ Nullable(Interval) โ”‚
79+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
80+
โ”‚ Alpha โ”‚ 3 years 3 months 29 days โ”‚
81+
โ”‚ Beta โ”‚ 9 months 17 days โ”‚
82+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
83+
```
84+
85+
86+
## See Also
87+
88+
- [DATE_DIFF](date-diff.md): Alternative function for calculating specific time unit differences
89+

โ€Ždocs/en/sql-reference/20-sql-functions/05-datetime-functions/date-add.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,34 @@ SELECT
5959
DATE_ADD(HOUR, 1, now()): 2024-10-10 02:35:33.601312
6060
DATE_ADD(MINUTE, 1, now()): 2024-10-10 01:36:33.601312
6161
DATE_ADD(SECOND, 1, now()): 2024-10-10 01:35:34.601312
62-
```
62+
```
63+
64+
:::note
65+
- When unit is MONTH, If date is the last day of the month or if the resulting month has fewer days than the day component of date,
66+
- then the result is the last day of the resulting month. Otherwise, the result has the same day component as date.
67+
68+
When adding a month to a date that would result in an invalid date (e.g., January 31 โ†’ February 31), it returns the last valid day of the resulting month:
69+
70+
```sql
71+
SELECT DATE_ADD(month, 1, '2023-01-31'::DATE) ;
72+
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
73+
โ”‚ DATE_ADD(MONTH, 1, '2023-01-31'::DATE) โ”‚
74+
โ”‚ Date โ”‚
75+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
76+
โ”‚ 2023-02-28 โ”‚
77+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
78+
79+
```
80+
81+
When adding a month to a date where the resulting month has sufficient days, it performs simple month arithmetic:
82+
83+
```sql
84+
SELECT DATE_ADD(month, 1, '2023-02-28'::DATE);
85+
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
86+
โ”‚ DATE_ADD(MONTH, 1, '2023-02-28'::DATE) โ”‚
87+
โ”‚ Date โ”‚
88+
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
89+
โ”‚ 2023-03-28 โ”‚
90+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
91+
92+
```

โ€Ždocs/en/sql-reference/20-sql-functions/05-datetime-functions/index.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,17 @@ This page provides a comprehensive overview of Date & Time functions in Databend
4545

4646
## Date & Time Arithmetic Functions
4747

48-
| Function | Description | Example |
49-
|----------|-------------|---------|
50-
| [DATE_ADD](date-add.md) | Adds a time interval to a date | `DATE_ADD(DAY, 7, '2024-06-04')` โ†’ `2024-06-11` |
51-
| [DATE_SUB](date-sub.md) | Subtracts a time interval from a date | `DATE_SUB(MONTH, 1, '2024-06-04')` โ†’ `2024-05-04` |
52-
| [ADD INTERVAL](addinterval.md) | Adds an interval to a date | `'2024-06-04' + INTERVAL 1 DAY` โ†’ `2024-06-05` |
53-
| [SUBTRACT INTERVAL](subtractinterval.md) | Subtracts an interval from a date | `'2024-06-04' - INTERVAL 1 MONTH` โ†’ `2024-05-04` |
54-
| [DATE_DIFF](date-diff.md) | Returns the difference between two dates | `DATE_DIFF(DAY, '2024-06-01', '2024-06-04')` โ†’ `3` |
55-
| [TIMESTAMP_DIFF](timestamp-diff.md) | Returns the difference between two timestamps | `TIMESTAMP_DIFF(HOUR, '2024-06-04 10:00:00', '2024-06-04 15:00:00')` โ†’ `5` |
56-
| [MONTHS_BETWEEN](months-between.md) | Returns the number of months between two dates | `MONTHS_BETWEEN('2024-06-04', '2024-01-04')` โ†’ `5` |
57-
| [DATE_BETWEEN](date-between.md) | Checks if a date is between two other dates | `DATE_BETWEEN('2024-06-04', '2024-06-01', '2024-06-10')` โ†’ `true` |
48+
| Function | Description | Example |
49+
|------------------------------------------|----------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
50+
| [DATE_ADD](date-add.md) | Adds a time interval to a date | `DATE_ADD(DAY, 7, '2024-06-04')` โ†’ `2024-06-11` |
51+
| [DATE_SUB](date-sub.md) | Subtracts a time interval from a date | `DATE_SUB(MONTH, 1, '2024-06-04')` โ†’ `2024-05-04` |
52+
| [ADD INTERVAL](addinterval.md) | Adds an interval to a date | `'2024-06-04' + INTERVAL 1 DAY` โ†’ `2024-06-05` |
53+
| [SUBTRACT INTERVAL](subtractinterval.md) | Subtracts an interval from a date | `'2024-06-04' - INTERVAL 1 MONTH` โ†’ `2024-05-04` |
54+
| [DATE_DIFF](date-diff.md) | Returns the difference between two dates | `DATE_DIFF(DAY, '2024-06-01', '2024-06-04')` โ†’ `3` |
55+
| [TIMESTAMP_DIFF](timestamp-diff.md) | Returns the difference between two timestamps | `TIMESTAMP_DIFF(HOUR, '2024-06-04 10:00:00', '2024-06-04 15:00:00')` โ†’ `5` |
56+
| [MONTHS_BETWEEN](months-between.md) | Returns the number of months between two dates | `MONTHS_BETWEEN('2024-06-04', '2024-01-04')` โ†’ `5` |
57+
| [DATE_BETWEEN](date-between.md) | Checks if a date is between two other dates | `DATE_BETWEEN('2024-06-04', '2024-06-01', '2024-06-10')` โ†’ `true` |
58+
| [AGE](age.md) | Calculate the difference between timestamps or between a timestamp and the current date/time | `AGE('2000-01-01'::TIMESTAMP, '1990-05-15'::TIMESTAMP)` โ†’ `9 years 7 months 17 days` |
5859

5960
## Date & Time Truncation Functions
6061

โ€Ždocs/en/sql-reference/20-sql-functions/06-string-functions/index.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,16 @@ This page provides a comprehensive overview of String functions in Databend, org
1616

1717
## String Extraction
1818

19-
| Function | Description | Example |
20-
|----------|-------------|---------|
21-
| [LEFT](left.md) | Returns leftmost characters | `LEFT('databend', 4)` โ†’ `'data'` |
22-
| [RIGHT](right.md) | Returns rightmost characters | `RIGHT('databend', 4)` โ†’ `'bend'` |
23-
| [SUBSTR](substr.md) / [SUBSTRING](substring.md) | Extracts a substring | `SUBSTR('databend', 5, 4)` โ†’ `'bend'` |
24-
| [MID](mid.md) | Extracts a substring (alias for SUBSTRING) | `MID('databend', 5, 4)` โ†’ `'bend'` |
25-
| [SPLIT](split.md) | Splits a string into an array | `SPLIT('data,bend', ',')` โ†’ `['data', 'bend']` |
26-
| [SPLIT_PART](split-part.md) | Returns a specific part after splitting | `SPLIT_PART('data,bend', ',', 2)` โ†’ `'bend'` |
19+
| Function | Description | Example |
20+
|-------------------------------------------------|----------------------------------------------------------------------|----------------------------------------------------------------------------------------|
21+
| [LEFT](left.md) | Returns leftmost characters | `LEFT('databend', 4)` โ†’ `'data'` |
22+
| [RIGHT](right.md) | Returns rightmost characters | `RIGHT('databend', 4)` โ†’ `'bend'` |
23+
| [SUBSTR](substr.md) / [SUBSTRING](substring.md) | Extracts a substring | `SUBSTR('databend', 5, 4)` โ†’ `'bend'` |
24+
| [MID](mid.md) | Extracts a substring (alias for SUBSTRING) | `MID('databend', 5, 4)` โ†’ `'bend'` |
25+
| [SPLIT](split.md) | Splits a string into an array | `SPLIT('data,bend', ',')` โ†’ `['data', 'bend']` |
26+
| [SPLIT_PART](split-part.md) | Returns a specific part after splitting | `SPLIT_PART('data,bend', ',', 2)` โ†’ `'bend'` |
27+
| [REGEXP_SPLIT_TO_ARRAY](regexp-split-array.md) | Split a string into an array of segments using the specified pattern | `regexp_split_to_array('apple,banana,orange', ',');` โ†’ `'['apple','banana','orange']'` |
28+
| [REGEXP_SPLIT_TO_TABLE](regexp-split-table.md) | Split a string into a table of segments using the specified pattern | `regexp_split_to_table('data,bend', ',', 2)` |
2729

2830
## String Padding and Formatting
2931

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
---
2+
title: REGEXP_SPLIT_TO_ARRAY
3+
---
4+
5+
import FunctionDescription from '@site/src/components/FunctionDescription';
6+
7+
<FunctionDescription description="Introduced or updated: v1.2.756"/>
8+
9+
Splits a string using a regular expression pattern and returns the segments as an array.
10+
11+
## Syntax
12+
13+
```sql
14+
REGEXP_SPLIT_TO_ARRAY(string, pattern [, flags text])
15+
```
16+
17+
| Parameter | Description |
18+
|--------------|----------------------------------------------------------------|
19+
| `string` | The input string to split (VARCHAR type) |
20+
| `pattern` | Regular expression pattern used for splitting (VARCHAR type) |
21+
| `flags text` | A string of flags to modify the regular expression's behavior. |
22+
23+
**Supported `flags` Parameter:**
24+
Provides flexible regular expression configuration options, controlling matching behavior by combining the following characters:
25+
* `i` (case-insensitive): Pattern matching ignores case.
26+
* `c` (case-sensitive): Pattern matching is case-sensitive (default behavior).
27+
* `n` or `m` (multi-line): Enables multi-line mode. In this mode, `^` and `$` match the beginning and end of the string, respectively, as well as the beginning and end of each line; the dot `.` does not match newline characters.
28+
* `s` (single-line): Enables single-line mode (also known as dot-matches-newline). In this mode, the dot `.` matches any character, including newline characters.
29+
* `x` (ignore-whitespace): Ignores whitespace characters in the pattern (improves pattern readability).
30+
* `q` (literal): Treats the `pattern` as a literal string rather than a regular expression.
31+
32+
## Examples
33+
34+
### Basic Splitting
35+
```sql
36+
SELECT REGEXP_SPLIT_TO_ARRAY('apple,orange,banana', ',');
37+
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
38+
โ”‚ ["apple","orange","banana"] โ”‚
39+
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
40+
```
41+
42+
### Complex Delimiters
43+
```sql
44+
SELECT REGEXP_SPLIT_TO_ARRAY('2023-01-01T14:30:00', '[-T:]');
45+
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
46+
โ”‚ ["2023","01","01","14","30","00"] โ”‚
47+
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
48+
```
49+
50+
### Handling Empty Elements
51+
```sql
52+
SELECT REGEXP_SPLIT_TO_ARRAY('a,,b,,,c', ',+');
53+
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
54+
โ”‚ ["a","b","c"] โ”‚
55+
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
56+
```
57+
58+
### With flag text
59+
60+
```sql
61+
SELECT regexp_split_to_array('One_Two_Three', '[_-]', 'i')
62+
63+
โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
64+
โ”‚ ['One','Two','Three'] โ”‚
65+
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
66+
67+
```
68+
69+
70+
## See Also
71+
72+
- [SPLIT](split.md): For simple string splitting
73+
- [REGEXP_SPLIT_TO_TABLE](regexp-split-table.md): split string to table
74+

0 commit comments

Comments
ย (0)