Custom queries in BigQuery

This page explains how to set up and view prebuilt reports in BigQuery.

In Google Cloud console, you can write your custom query based on the table name or prebuilt report and save it as a query or as a view.

Write custom queries in BigQuery as a query

To write custom queries in BigQuery as a query, do the following:

  1. In the Google Cloud console, go to the BigQuery Studio page:

    Go to BigQuery Studio page

  2. In the Explorer panel, expand your project and select a dataset.
  3. Click the dataset name to expand it.

    The tables and views in the dataset appear.

  4. Click the table name or a prebuilt report.

    The Details tab displays the table's description and the Schema tab displays the table's schema definition.

  5. Click Query and select either In new tab or In split tab.

    A new tab opens with a sample query.

  6. Write a query based on the field names that are populated in the Schema tab.

  7. Click Run. This displays the preview of the query results.

  8. Click Save query.

  9. In the Save query dialog, type a name for the saved query.

You can download and save queries to the selected location. For more information, see Downloading and saving query results from the Google Cloud console.

Write custom queries in BigQuery as a view

To write custom queries in BigQuery as a view, do the following:

  1. In the Google Cloud console, go to the BigQuery Studio page:

    Go to BigQuery Studio page

  2. In the Explorer panel, expand your project and select a dataset.
  3. Click the dataset name to expand it.

    The tables and views in the dataset appear.

  4. Click the table name or a prebuilt report.

    The Details tab displays the table's description and the Schema tab displays the table's schema definition.

  5. Click Query and select either In new tab or In split tab.

    A new tab opens with a sample query.

  6. Write a query based on the field names that are populated in the Schema tab.

  7. Click Run. This displays the preview of the query results.

  8. Click Save view.

  9. In the Save view dialog, do the following:

    1. In the Project list, click Browse and select a project.
    2. In the Dataset list, select a dataset to store the view. The dataset that contains your view and the dataset that contains the tables referenced by the view must be in the same location.
    3. In Table name, enter a name for the view.
    4. Click Save.

You can download and save queries to the selected location. For more information, see Downloading and saving query results from the Google Cloud console.

What's next