CREATE TABLE Statement syntax in BigQuery

Use the create table statement to create a new permanent table. The table name must be unique per dataset. The table name can:

  • Contain up to 1,024 characters
  • Contain letters (upper or lower case), numbers, and underscores
  • And is case sensitive
#standardSQL
CREATE TABLE mydataset.newtable
(
transaction_id INT64,
transaction_date DATE,
City string,
Branch Int64,
Customer_Name string,
Amount INT64
)
PARTITION BY transaction_date
CLUSTER BY City, Branch

You can have only one column in the partition by clause, and it has to be a date or timestamp field. You can have up to four columns in the CLUSTER BY Field. 

Create table with Partition Expiration:

CREATE TABLE mydataset.newtable 
(
transaction_id INT64,
transaction_date DATE,
City string,
Branch Int64,
Customer_Name string,
Amount INT64
)
PARTITION BY transaction_date
CLUSTER BY City, Branch OPTIONS(partition_expiration_days=7);

nVector

posted on 02 Apr 19

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds