Skip to content

Commit 1ccb6e2

Browse files
authored
updates (#806)
1 parent 674a23d commit 1ccb6e2

38 files changed

+232
-216
lines changed

docs/en/sql-reference/20-sql-functions/05-datetime-functions/addinterval.md

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,51 +26,58 @@ ADD_SECONDS(<exp0>, <expr1>)
2626

2727
```sql
2828
SELECT to_date(18875), add_years(to_date(18875), 2);
29-
+----------------+------------------------------+
30-
| to_date(18875) | add_years(to_date(18875), 2) |
31-
+----------------+------------------------------+
32-
| 2021-09-05 | 2023-09-05 |
33-
+----------------+------------------------------+
29+
30+
┌───────────────────────────────────────────────┐
31+
│ to_date(18875) │ add_years(to_date(18875), 2) │
32+
├────────────────┼──────────────────────────────┤
33+
2021-09-052023-09-05
34+
└───────────────────────────────────────────────┘
3435

3536
SELECT to_date(18875), add_quarters(to_date(18875), 2);
36-
+----------------+---------------------------------+
37-
| to_date(18875) | add_quarters(to_date(18875), 2) |
38-
+----------------+---------------------------------+
39-
| 2021-09-05 | 2022-03-05 |
40-
+----------------+---------------------------------+
37+
38+
┌──────────────────────────────────────────────────┐
39+
│ to_date(18875) │ add_quarters(to_date(18875), 2) │
40+
├────────────────┼─────────────────────────────────┤
41+
2021-09-052022-03-05
42+
└──────────────────────────────────────────────────┘
4143

4244
SELECT to_date(18875), add_months(to_date(18875), 2);
43-
+----------------+-------------------------------+
44-
| to_date(18875) | add_months(to_date(18875), 2) |
45-
+----------------+-------------------------------+
46-
| 2021-09-05 | 2021-11-05 |
47-
+----------------+-------------------------------+
45+
46+
┌────────────────────────────────────────────────┐
47+
│ to_date(18875) │ add_months(to_date(18875), 2) │
48+
├────────────────┼───────────────────────────────┤
49+
2021-09-052021-11-05
50+
└────────────────────────────────────────────────┘
4851

4952
SELECT to_date(18875), add_days(to_date(18875), 2);
50-
+----------------+-----------------------------+
51-
| to_date(18875) | add_days(to_date(18875), 2) |
52-
+----------------+-----------------------------+
53-
| 2021-09-05 | 2021-09-07 |
54-
+----------------+-----------------------------+
53+
54+
┌──────────────────────────────────────────────┐
55+
│ to_date(18875) │ add_days(to_date(18875), 2) │
56+
├────────────────┼─────────────────────────────┤
57+
2021-09-052021-09-07
58+
└──────────────────────────────────────────────┘
5559

5660
SELECT to_datetime(1630833797), add_hours(to_datetime(1630833797), 2);
57-
+----------------------------+---------------------------------------+
58-
| to_datetime(1630833797) | add_hours(to_datetime(1630833797), 2) |
59-
+----------------------------+---------------------------------------+
60-
| 2021-09-05 09:23:17.000000 | 2021-09-05 11:23:17.000000 |
61-
+----------------------------+---------------------------------------+
61+
62+
┌─────────────────────────────────────────────────────────────────┐
63+
│ to_datetime(1630833797) │ add_hours(to_datetime(1630833797), 2) │
64+
├─────────────────────────┼───────────────────────────────────────┤
65+
2021-09-05 09:23:172021-09-05 11:23:17
66+
└─────────────────────────────────────────────────────────────────┘
6267

6368
SELECT to_datetime(1630833797), add_minutes(to_datetime(1630833797), 2);
64-
+----------------------------+-----------------------------------------+
65-
| to_datetime(1630833797) | add_minutes(to_datetime(1630833797), 2) |
66-
+----------------------------+-----------------------------------------+
67-
| 2021-09-05 09:23:17.000000 | 2021-09-05 09:25:17.000000 |
68-
+----------------------------+-----------------------------------------+
69+
70+
┌───────────────────────────────────────────────────────────────────┐
71+
│ to_datetime(1630833797) │ add_minutes(to_datetime(1630833797), 2) │
72+
├─────────────────────────┼─────────────────────────────────────────┤
73+
2021-09-05 09:23:172021-09-05 09:25:17
74+
└───────────────────────────────────────────────────────────────────┘
6975

7076
SELECT to_datetime(1630833797), add_seconds(to_datetime(1630833797), 2);
71-
+----------------------------+-----------------------------------------+
72-
| to_datetime(1630833797) | add_seconds(to_datetime(1630833797), 2) |
73-
+----------------------------+-----------------------------------------+
74-
| 2021-09-05 09:23:17.000000 | 2021-09-05 09:23:19.000000 |
75-
+----------------------------+-----------------------------------------+
77+
78+
┌───────────────────────────────────────────────────────────────────┐
79+
│ to_datetime(1630833797) │ add_seconds(to_datetime(1630833797), 2) │
80+
├─────────────────────────┼─────────────────────────────────────────┤
81+
2021-09-05 09:23:172021-09-05 09:23:19
82+
└───────────────────────────────────────────────────────────────────┘
7683
```

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ The function returns a value of the same type as the `<date_or_time_expr>` argum
2626
Query:
2727
```sql
2828
SELECT date_add(YEAR, 1, to_date('2018-01-02'));
29-
+---------------------------------------------------+
30-
| DATE_ADD(YEAR, INTERVAL 1, to_date('2018-01-02')) |
31-
+---------------------------------------------------+
32-
| 2019-01-02 |
33-
+---------------------------------------------------+
29+
30+
┌──────────────────────────────────────────┐
31+
│ date_add(year, 1, to_date('2018-01-02')) │
32+
Date
33+
├──────────────────────────────────────────┤
34+
2019-01-02
35+
└──────────────────────────────────────────┘
3436
```

docs/en/sql-reference/20-sql-functions/05-datetime-functions/date-diff.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ VALUES
2222
SELECT task_name, end_date - start_date AS duration
2323
FROM tasks;
2424

25-
task_name|duration|
26-
---------+--------+
27-
Task 1 | 5|
28-
Task 2 | 7|
29-
Task 3 | 3|
25+
┌────────────────────────────────────┐
26+
│ task_name │ duration │
27+
├──────────────────┼─────────────────┤
28+
│ Task 15
29+
│ Task 27
30+
│ Task 33
31+
└────────────────────────────────────┘
3032
```

docs/en/sql-reference/20-sql-functions/05-datetime-functions/date-part.md

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,42 @@ Integer.
2828
```sql
2929
SELECT NOW();
3030

31-
now() |
32-
---------------------+
33-
2023-10-16 02:09:28.0|
31+
┌────────────────────────────┐
32+
│ now() │
33+
├────────────────────────────┤
34+
2024-05-22 02:55:52.954761
35+
└────────────────────────────┘
3436

3537
SELECT DATE_PART(DAY, NOW());
3638

37-
date_part(day, now())|
38-
---------------------+
39-
16|
39+
┌───────────────────────┐
40+
│ date_part(day, now()) │
41+
├───────────────────────┤
42+
22
43+
└───────────────────────┘
4044

41-
-- October 16, 2023, is a Monday
4245
SELECT DATE_PART(DOW, NOW());
4346

44-
date_part(dow, now())|
45-
---------------------+
46-
1|
47+
┌───────────────────────┐
48+
│ date_part(dow, now()) │
49+
├───────────────────────┤
50+
3
51+
└───────────────────────┘
4752

48-
-- October 16, 2023, is the 289th day of the year
4953
SELECT DATE_PART(DOY, NOW());
5054

51-
date_part(doy, now())|
52-
---------------------+
53-
289|
55+
┌───────────────────────┐
56+
│ date_part(doy, now()) │
57+
├───────────────────────┤
58+
143
59+
└───────────────────────┘
5460

55-
SELECT DATE_PART(MONTH, TO_DATE('2022-05-13'));
61+
SELECT DATE_PART(MONTH, TO_DATE('2024-05-21'));
5662

57-
date_part(month, to_date('2022-05-13'))|
58-
---------------------------------------+
59-
5|
63+
┌─────────────────────────────────────────┐
64+
│ date_part(month, to_date('2024-05-21')) │
65+
│ UInt8 │
66+
├─────────────────────────────────────────┤
67+
5
68+
└─────────────────────────────────────────┘
6069
```

docs/en/sql-reference/20-sql-functions/05-datetime-functions/date-sub.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ The function returns a value of the same type as the `<date_or_time_expr>` argum
2323

2424
## Examples
2525

26-
Query:
2726
```sql
2827
SELECT date_sub(YEAR, 1, to_date('2018-01-02'));
29-
+---------------------------------------------------+
30-
| DATE_SUB(YEAR, INTERVAL 1, to_date('2018-01-02')) |
31-
+---------------------------------------------------+
32-
| 2017-01-02 |
33-
+---------------------------------------------------+
28+
29+
┌──────────────────────────────────────────┐
30+
│ date_sub(year, 1, to_date('2018-01-02')) │
31+
├──────────────────────────────────────────┤
32+
2017-01-02
33+
└──────────────────────────────────────────┘
3434
```

docs/en/sql-reference/20-sql-functions/05-datetime-functions/date-trunc.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ The function returns a value of the same type as the `<date_or_time_expr>` argum
2424

2525
```sql
2626
select date_trunc(month, to_date('2022-07-07'));
27-
+------------------------------------------+
28-
| date_trunc(month, to_date('2022-07-07')) |
29-
+------------------------------------------+
30-
| 2022-07-01 |
31-
+------------------------------------------+
27+
28+
┌──────────────────────────────────────────┐
29+
│ date_trunc(month, to_date('2022-07-07')) │
30+
├──────────────────────────────────────────┤
31+
2022-07-01
32+
└──────────────────────────────────────────┘
3233
```

docs/en/sql-reference/20-sql-functions/05-datetime-functions/extract.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,42 @@ Integer.
2828
```sql
2929
SELECT NOW();
3030

31-
now() |
32-
---------------------+
33-
2023-10-16 02:09:28.0|
31+
┌────────────────────────────┐
32+
│ now() │
33+
├────────────────────────────┤
34+
2024-05-22 03:00:35.977589
35+
└────────────────────────────┘
3436

3537
SELECT EXTRACT(DAY FROM NOW());
3638

37-
extract(day from now())|
38-
-----------------------+
39-
16|
39+
┌─────────────────────────┐
40+
│ extract(day from now()) │
41+
├─────────────────────────┤
42+
22
43+
└─────────────────────────┘
4044

41-
-- October 16, 2023, is a Monday
4245
SELECT EXTRACT(DOW FROM NOW());
4346

44-
extract(dow from now())|
45-
-----------------------+
46-
1|
47+
┌─────────────────────────┐
48+
│ extract(dow from now()) │
49+
├─────────────────────────┤
50+
3
51+
└─────────────────────────┘
4752

48-
-- October 16, 2023, is the 289th day of the year
4953
SELECT EXTRACT(DOY FROM NOW());
5054

51-
extract(doy from now())|
52-
-----------------------+
53-
289|
55+
┌─────────────────────────┐
56+
│ extract(doy from now()) │
57+
├─────────────────────────┤
58+
143
59+
└─────────────────────────┘
5460

5561
SELECT EXTRACT(MONTH FROM TO_DATE('2022-05-13'));
5662

57-
extract(month from to_date('2022-05-13'))|
58-
-----------------------------------------+
59-
5|
63+
┌───────────────────────────────────────────┐
64+
│ extract(month from to_date('2022-05-13')) │
65+
│ UInt8 │
66+
├───────────────────────────────────────────┤
67+
5
68+
└───────────────────────────────────────────┘
6069
```

0 commit comments

Comments
 (0)