You can analyze Backup and DR logs that are routed to BigQuery by
writing custom SQL queries. Saving custom queries as saved queries or views
helps you reuse analyses and share them with collaborators. This approach also
establishes consistent data access patterns for reporting. In the
Google Cloud console, you can write and save custom queries by using either a table
name or a prebuilt report.

## 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](https://console.cloud.google.com/bigquery)
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](https://docs.cloud.google.com/bigquery/docs/writing-results.md.txt#downloading-saving-results-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](https://console.cloud.google.com/bigquery)
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](https://docs.cloud.google.com/bigquery/docs/dataset-locations).
   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](https://docs.cloud.google.com/bigquery/docs/writing-results.md.txt#downloading-saving-results-console).

## What's next

- Learn how to [View prebuilt reports in Google connected sheets](https://docs.cloud.google.com/backup-disaster-recovery/docs/monitor-reports/view-reports-sheets.md.txt)
- Learn how to [View prebuilt reports in Looker](https://docs.cloud.google.com/backup-disaster-recovery/docs/monitor-reports/view-reports-lookerstudio.md.txt)