sql造数据

造一行常量数据SQL

select “col1”,“col2”,“col3”

造多行多列

select  concat('AAA', ':', "BBB", '_PP', ':', "XXXXX") as key1,
        concat(
            '{"Id":"',
            "12323213",
            '","url":"',
            "http://helloworld.com/hello.html",
            '","code":"',
            "hello",
            '"}'
        ) as key2
union  
select  concat('AAA', ':', "BBB", '_PP', ':', "YYYYY") as key1,
        concat(
            '{"Id":"',
            "12323213",
            '","url":"',
            "http://helloworld.com/hello.html",
            '","code":"',
            "hello",
            '"}'
        ) as key2

{“Id”:“12323213”,“url”:“http://helloworld.com/hello.html”,“code”:“hello”}

行列数据转为结构体数组

select array(named_struct('name',name,'age',age) ) from (
select  concat('AAA', ':', "BBB", '_PP', ':', "XXXXX") as name,
        concat(
            '{"Id":"',
            "12323213",
            '","url":"',
            "http://helloworld.com/hello.html",
            '","code":"',
            "hello",
            '"}'
        ) as age
union  
select  concat('AAA', ':', "BBB", '_PP', ':', "YYYYY") as name,
        concat(
            '{"Id":"',
            "12323213",
            '","url":"',
            "http://helloworld.com/hello.html",
            '","code":"',
            "hello",
            '"}'
        ) as age
)

相关推荐

  1. sql数据

    2024-03-29 09:32:03       19 阅读
  2. 数据库数据发现的bug也是bug

    2024-03-29 09:32:03       40 阅读
  3. <span style='color:red;'>SQL</span><span style='color:red;'>数列</span>

    SQL数列

    2024-03-29 09:32:03      44 阅读
  4. 数据库SQL

    2024-03-29 09:32:03       33 阅读

最近更新

  1. TCP协议是安全的吗?

    2024-03-29 09:32:03       19 阅读
  2. 阿里云服务器执行yum,一直下载docker-ce-stable失败

    2024-03-29 09:32:03       19 阅读
  3. 【Python教程】压缩PDF文件大小

    2024-03-29 09:32:03       19 阅读
  4. 通过文章id递归查询所有评论(xml)

    2024-03-29 09:32:03       20 阅读

热门阅读

  1. Odoo配置邮件服务器

    2024-03-29 09:32:03       19 阅读
  2. 网络安全产品之认识4A统一安全管理平台

    2024-03-29 09:32:03       17 阅读
  3. 数据分析-GroupBy的排序和缺失值处理

    2024-03-29 09:32:03       19 阅读
  4. 实现简易的 axios

    2024-03-29 09:32:03       18 阅读
  5. 毛细管制冷系统的设计要点

    2024-03-29 09:32:03       15 阅读