简体   繁体   English

BigQuery 中的“创建表为”

[英]'Create Table As' in BigQuery

How to create a table on the basis of result of select query in BigQuery?如何在 BigQuery 中根据select查询的结果创建表?

For example:例如:

create table abc as select x,y,z from mnp;

Is there any way or workaround to achieve the same in BigQuery?有什么方法或解决方法可以在 BigQuery 中实现相同的目的吗?

Any leads?有线索吗?

Just try giving the GCP folder name before table name in create table statement.只需尝试在 create table 语句中的表名之前给出 GCP 文件夹名称。

Example:例子:

create table [GCP_Folder].abc as select x,y,z from mnp

CREATE OR REPLACE TABLE [GCP_Folder].abc AS SELECT x,y,z FROM mnp

This wont get the error Cannot set write disposition in jobs with DDL statements .这不会得到错误Cannot set write disposition in jobs with DDL statements no source to refer, its trial and error from my end.没有可参考的来源,它的试验和错误来自我的目的。

已经可以像CREATE OR REPLACE project.dataset.table AS SELECT x,y,z FROM 'project.dataset.mnp'

You can create a table using another table as the starting point.您可以使用另一个表作为起点来创建一个表。 This method basically allows you to duplicate another table (or a part of it, if you add a WHERE clause in the SELECT statement).这种方法基本上允许您复制另一个表(或它的一部分,如果您在SELECT语句中添加WHERE子句)。

CREATE TABLE project_name.dataset_name.table (your destination) AS SELECT column_a,column_b,... FROM (UNION/JOIN for example)

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

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