BigQuery reference
BigQuery DDL statements
Data definition language creates and changes tables, views, materialized views and functions. Partitioning and clustering, set here, are the two settings that most affect query cost.
Statements and clauses in this category
| Statement or clause | What it does |
|---|---|
| ALTER TABLE | ALTER TABLE changes a BigQuery table without rewriting it: ADD COLUMN, DROP COLUMN, RENAME TO, RENAME COLUMN, SET OPTIONS (expiration, description, labels, partition filter) and ALTER COLUMN SET DATA TYPE for widening changes such as INT64 to NUMERIC. |
| CLUSTER BY | CLUSTER BY sorts a BigQuery table's storage blocks by up to four columns, so queries that filter on those columns skip blocks and bill fewer bytes. |
| CREATE FUNCTION | CREATE FUNCTION defines a user-defined function (UDF) in SQL or JavaScript. |
| CREATE MATERIALIZED VIEW | CREATE MATERIALIZED VIEW stores the result of an aggregation over a BigQuery table and keeps it current automatically. |
| CREATE TABLE | CREATE TABLE creates a BigQuery table from a column list, from a query (CREATE TABLE AS SELECT), or both, with optional partitioning, clustering and OPTIONS such as expiration and description. |
| CREATE TEMP TABLE | CREATE TEMP TABLE stores intermediate results in a table that exists only for the current multi-statement query or session, without a dataset. |
| CREATE VIEW | CREATE VIEW saves a query under a table-like name. |
| PARTITION BY (partitioned tables) | PARTITION BY in CREATE TABLE splits a BigQuery table into partitions by a DATE, TIMESTAMP or DATETIME column, by ingestion time, or by integer ranges. |
More of the BigQuery reference
Date functionsDatetime functionsTimestamp functionsString functionsAggregate functionsWindow functionsArray functionsJSON functionsConversion functionsConditional expressionsMathematical functionsHash and utility functionsQuery syntaxDML statementsScripting and data movementINFORMATION_SCHEMAError messagesBigQuery pricingPricing calculator
