Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a BigQuery View

How could I create a BigQuery view via UI command or BQ command line?

I want to create a view like:

CREATE VIEW mydataset.myview AS
SELECT field1, field2 
FROM mydataset.mytable
like image 605
user3267734 Avatar asked Sep 08 '14 06:09

user3267734


People also ask

What is a BigQuery view?

A view is a virtual table defined by a SQL query. When you create a view, you query it in the same way you query a table. When a user queries the view, the query results contain data only from the tables and fields specified in the query that defines the view.

How do I save a view as a table in BigQuery?

BigQuery Create View Setup: Using the BigQuery ConsoleWhile choosing the “Project Name”, select a project to store the view. In “Dataset Name”, select a dataset to store the view. Finally, for “Table Name”, mention the name of the view. Click on “Save”.


2 Answers

  1. Edit your query in the web UI
  2. Choose "Save View" (near the "Run Query" button)
  3. configure the name and dataset

...

like image 168
N.N. Avatar answered Sep 28 '22 03:09

N.N.


It looks like now is supported the views creation through standard sql. It requires specify project, dataset and table/view name. For example

create view `myproject.mydataset.myview` as select * from `myproject.mydataset.mytable`;
like image 36
hlagos Avatar answered Sep 28 '22 03:09

hlagos