Skip to content

Commit ff9acf5

Browse files
💬Generate LLM translations (#1696)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: z <[email protected]>
1 parent 547ee37 commit ff9acf5

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

docs/cn/sql-reference/10-sql-commands/20-query-syntax/05-query-unpivot.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ title: UNPIVOT
44

55
`UNPIVOT` 操作通过将列转换为行来旋转表。
66

7-
它是一个关系运算符,接受两列(来自表或子查询)以及一个列列表,并为列表中指定的每个列生成一行。在查询中,它是在表名或子查询之后的 FROM 子句中指定的
7+
它是一种关系运算符,接受两列(来自表或子查询)以及一个列列表,并为列表中指定的每一列生成一行。在查询中,它在表名或子查询后的 FROM 子句中指定
88

99
**另请参阅:**
1010
[PIVOT](./05-query-pivot.md)
@@ -22,16 +22,16 @@ FROM ...
2222
```
2323

2424
其中:
25-
* `<value_column>`:将存储从 `<column_list>` 列列表中提取的值的列
26-
* `<name_column>`将存储从中提取值的列名称的列
27-
* `<column_list>`:要取消透视的列列表,用逗号分隔
25+
* `<value_column>`:将存储从 `<column_list>` 中列出的列中提取的值的列
26+
* `<name_column>`将存储从中提取值的列名的列
27+
* `<column_list>`:要取消透视的列列表,以逗号分隔。您可以选择使用 AS 为列名提供别名,或者直接使用字符串字面量
2828

2929

3030
## 示例
3131

32-
让我们取消透视单独的月份列,以返回每个员工的每月销售值
32+
让我们取消透视各个月份的列,以返回每个员工每月的单一销售值
3333

34-
### 创建和插入数据
34+
### 创建并插入数据
3535

3636

3737
```sql
@@ -57,21 +57,22 @@ INSERT INTO unpivoted_monthly_sales VALUES
5757
SELECT *
5858
FROM unpivoted_monthly_sales
5959
UNPIVOT (amount
60-
FOR month IN (jan, feb, mar, apr));
60+
FOR month IN (jan as 'Jan', feb AS 'Feb', mar 'MARCH', apr));
6161
```
6262

6363
输出:
6464
```sql
65-
+-------+-------+--------+
66-
| empid | month | amount |
67-
+-------+-------+--------+
68-
| 1 | jan | 10400 |
69-
| 1 | feb | 8000 |
70-
| 1 | mar | 11000 |
71-
| 1 | apr | 18000 |
72-
| 2 | jan | 39500 |
73-
| 2 | feb | 90700 |
74-
| 2 | mar | 12000 |
75-
| 2 | apr | 5300 |
76-
+-------+-------+--------+
65+
┌──────────────────────────────────────────────────────┐
66+
│ empid │ month │ amount │
67+
├─────────────────┼──────────────────┼─────────────────┤
68+
1 │ Jan │ 10400
69+
1 │ Feb │ 8000
70+
1 │ MARCH │ 11000
71+
1 │ apr │ 18000
72+
2 │ Jan │ 39500
73+
2 │ Feb │ 90700
74+
2 │ MARCH │ 12000
75+
2 │ apr │ 5300
76+
└──────────────────────────────────────────────────────┘
77+
7778
```

0 commit comments

Comments
 (0)