Request a demo

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 clauseWhat it does
ALTER TABLEALTER 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 BYCLUSTER 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 FUNCTIONCREATE FUNCTION defines a user-defined function (UDF) in SQL or JavaScript.
CREATE MATERIALIZED VIEWCREATE MATERIALIZED VIEW stores the result of an aggregation over a BigQuery table and keeps it current automatically.
CREATE TABLECREATE 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 TABLECREATE TEMP TABLE stores intermediate results in a table that exists only for the current multi-statement query or session, without a dataset.
CREATE VIEWCREATE 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

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.