SelectDB Enterprise
参考手册
SQL 函数
标量函数
STRUCT 函数
STRUCT

STRUCT

描述

根据给定的值构造并返回 struct,参数可以是多列或常量

语法

STRUCT( <expr1> [ , <expr2> ... ] )

参数

参数说明
<expr>构造 struct 的输入内容

返回值

根据给定的值构造并返回 struct,参数可以是多列或常量

举例

select struct(1, 'a', "abc"),struct(null, 1, null),struct(cast('2023-03-16' as datetime));
+--------------------------------------+--------------------------------------+---------------------------------------------+
| struct(1, 'a', 'abc')                | struct(NULL, 1, NULL)                | struct(cast('2023-03-16' as DATETIMEV2(0))) |
+--------------------------------------+--------------------------------------+---------------------------------------------+
| {"col1":1, "col2":"a", "col3":"abc"} | {"col1":null, "col2":1, "col3":null} | {"col1":"2023-03-16 00:00:00"}              |
+--------------------------------------+--------------------------------------+---------------------------------------------+
© 2025 北京飞轮数据科技有限公司 京ICP备2022004029号 | Apache、Apache Doris 以及相关开源项目名称均为 Apache 基金会商标