简体   繁体   English

将 3 列长表转换为具有可变列数的紧凑“2D”表的操作的正确名称是什么?

[英]What is a correct name for an operation that turns 3-column long table into a compact "2D" table with variable number of columns?

For example, from this table例如,从这个表

row col山口 val
0 0 A一种 32 32
0 0 B 31 31
0 0 C C 35 35
1 1个 A一种 30 30
1 1个 B 29 29
1 1个 C C 29 29
2 2个 A一种 15 15
2 2个 B 14 14
2 2个 D 18 18
3 3个 A一种 34 34
3 3个 B 39 39
3 3个 C C 34 34
3 3个 D 35 35

it should produce this table:它应该产生这个表:

A一种 B C C D
0 0 32 32 31 31 35 35
1 1个 30 30 29 29 29 29
2 2个 15 15 14 14 18 18
3 3个 34 34 39 39 34 34 35 35

Is there some official, canonical (or at least popular specific unambiguous) term for such operation (or its reverse)?这种操作(或其相反)是否有一些官方的、规范的(或至少流行的特定明确的)术语?

I am trying to find (or implement & publish) a tool that transforms CSV this way, but am unsure what to search for (or how to name it).我正在尝试寻找(或实施并发布)以这种方式转换 CSV 的工具,但我不确定要搜索什么(或如何命名)。

The term is pivot .术语是pivot

Some databases have native support for pivot, eg SQL Server's PIVOT (and even UNPIVOT ) keywords.一些数据库原生支持 pivot,例如 SQL 服务器的PIVOT (甚至UNPIVOT )关键字。

For most databases you must craft a query that does the job.对于大多数数据库,您必须设计一个查询来完成这项工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM