Skip to content

Commit 207b364

Browse files
authored
Add FORMAT_BYTES and FORMAT_NANO_TIME functions (pingcap#20518) (pingcap#20519)
1 parent d1338e3 commit 207b364

File tree

2 files changed

+46
-3
lines changed

2 files changed

+46
-3
lines changed

TOC.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -950,12 +950,13 @@
950950
- [GROUP BY 聚合函数](/functions-and-operators/aggregate-group-by-functions.md)
951951
- [GROUP BY 修饰符](/functions-and-operators/group-by-modifier.md)
952952
- [窗口函数](/functions-and-operators/window-functions.md)
953+
- [序列函数](/functions-and-operators/sequence-functions.md)
954+
- [效用函数](/functions-and-operators/utility-functions.md)
953955
- [其它函数](/functions-and-operators/miscellaneous-functions.md)
956+
- [TiDB 特有的函数](/functions-and-operators/tidb-functions.md)
954957
- [精度数学](/functions-and-operators/precision-math.md)
955958
- [集合运算](/functions-and-operators/set-operators.md)
956-
- [序列函数](/functions-and-operators/sequence-functions.md)
957-
- [下推到 TiKV 的表达式列表](/functions-and-operators/expressions-pushed-down.md)
958-
- [TiDB 特有的函数](/functions-and-operators/tidb-functions.md)
959+
- [下推到 TiKV 的表达式列表](/functions-and-operators/expressions-pushed-down.md)
959960
- [Oracle 与 TiDB 函数和语法差异对照](/oracle-functions-to-tidb.md)
960961
- [聚簇索引](/clustered-indexes.md)
961962
- [约束](/constraints.md)
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: 效用函数
3+
summary: 了解 TiDB 中的效用函数。
4+
---
5+
6+
# 效用函数
7+
8+
本文介绍了 TiDB 支持的效用函数,这些函数旨在简化常见数据转换,使结果更易于阅读和理解。
9+
10+
## `FORMAT_BYTES()`
11+
12+
`FORMAT_BYTES()` 函数用于将字节数格式化为易于阅读的形式。
13+
14+
```sql
15+
SELECT FORMAT_BYTES(10*1024*1024);
16+
```
17+
18+
```
19+
+----------------------------+
20+
| FORMAT_BYTES(10*1024*1024) |
21+
+----------------------------+
22+
| 10.00 MiB |
23+
+----------------------------+
24+
1 row in set (0.001 sec)
25+
```
26+
27+
## `FORMAT_NANO_TIME()`
28+
29+
`FORMAT_NANO_TIME()` 函数用于将纳秒数格式化为易于阅读的时间形式。
30+
31+
```sql
32+
SELECT FORMAT_NANO_TIME(1000000);
33+
```
34+
35+
```
36+
+---------------------------+
37+
| FORMAT_NANO_TIME(1000000) |
38+
+---------------------------+
39+
| 1.00 ms |
40+
+---------------------------+
41+
1 row in set (0.001 sec)
42+
```

0 commit comments

Comments
 (0)