Skip to content
Advertisement

Can you create multiple tables with one query in Google Big query?

New create table feature has been released and I was wondering if it’s possible to create 2 or more tables with one query.

I tried, but it returns error

Error: Syntax error: Unexpected keyword CREATE at [8:1]

 #standardSQL
 CREATE OR REPLACE TABLE newtables_test.cg1_uk
 OPTIONS(
   description="blah blah blah"
 ) AS 
select 'x' as y;

CREATE OR REPLACE TABLE newtables_test.cg1_uk2 
as
select 'y' as x 

Any ideas? Is it even possible?

Thanks!

Advertisement

Answer

As per the documentation link in your question:

Only one CREATE statement is allowed.

So, looks like you cannot. Maybe someone else has a trick/workaround, but I’m not aware of any.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement