26 Jan 21 ·  mCollins in Bigquery ·        Bookmark ·  Report ·  More actions.. Lock comments ·  Pin thread

Create View Statement in Google BigQuery

Create BigQuery View

CREATE OR REPLACE VIEW DATASET.VIEWNAME AS 
SELECT * FROM DATASET.TABLENAME;

Create BigQuery View with Joins

CREATE OR REPLACE VIEW DATASET.VIEWNAME AS 
SELECT A.ID,B.NAME FROM DATASET.TABLENAME A
INNER JOIN DATASET.TABLENAME B ON A.ID = B.ID;

Create BigQuery Materialized View

Materialized views are precomputed views that periodically cache results of a query for increased performance and efficiency. The Materialized views help improve performance and save cost. Take a look at its limitations

CREATE MATERIALIZED VIEW dataset.viewname
AS SELECT product_id, SUM(clicks) AS sum_clicks
FROM my_dataset.my_base_table
GROUP BY 1