【问题标题】:How to exectute "Insert into select * " query with extra columns?如何使用额外的列执行“插入到 select *”查询?
【发布时间】:2021-03-10 09:36:24
【问题描述】:

在 bigquery 中,我创建了两个表 table1(id,name) 和 table2(id,name,address,time)。 table1 有 10 行,而 table2 为空。

我想将 table1 中的所有数据插入 table2 以及地址(所有行的“abc”)和时间(now())列的值。

编写insert into table2 select * from table1, "abc", now() 查询的最佳方式是什么?

【问题讨论】:

    标签: sql google-bigquery


    【解决方案1】:

    试试

    insert into table2 
    select *, "abc", CURRENT_TIMESTAMP()
    from table1
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-05-08
      • 1970-01-01
      • 2021-01-31
      • 1970-01-01
      • 1970-01-01
      • 2021-05-19
      • 1970-01-01
      • 2020-08-01
      相关资源
      最近更新 更多