Google BigQuery: A Beginner’s Guide
Tags: bigquery
Published: 2023-11-23 08:00:00

**As businesses grow, managing and analyzing data becomes challenging. Traditional data warehouses have become expensive to scale and can no longer handle large data sets.**

---
Tools used in this tutorial
[DbVisualizer](https://www.dbvis.com/), top rated database management tool and SQL client

---
Fortunately, Google BigQuery solves these problems as a cloud-based data warehouse. It is designed to handle large sets of data fast by using a serverless architecture. With Google BigQuery, you don’t have to worry about managing servers or resources.

In this guide, you will learn what Google BigQuery is, why should you use it, and how to get started. Also, you will learn how to add data into Google BigQuery and how to query the data.

## What is Google BigQuery?
Google BigQuery is a serverless data warehouse provided by Google Cloud. Google BigQuery enables businesses to store, query, and analyze large volumes of data efficiently and quickly.

The design of Google BigQuery enables it to handle petabyte-scale datasets by utilizing a distributed architecture to manage complex analytical workloads. In Google BigQuery, businesses can derive valuable insights from their data and make data-driven decisions.

## Uses of Google BigQuery and Why to use it
Google BigQuery helps you manage and analyze your data with built-in features like machine learning, geospatial analysis, and business intelligence. Some use cases for Google BigQuery include:

- **Business Intelligence:** Google BigQuery can be used to analyze business data such as sales, customer interactions, and marketing campaigns.
- **Internet of Things (IoT):** Google BigQuery can be used to analyze IoT data such as sensor readings and device logs.
- **Machine Learning:** Google BigQuery can be used to train machine learning models on large datasets.
- **Data Warehousing:** Google BigQuery can be used to store large amounts of structured and semi-structured data.
- **Real-time Analytics:** Google BigQuery can be used to analyze real-time data such as website traffic and social media feeds.

Here are some reasons you should use Google BigQuery:

- **Scalability:** BigQuery is built to handle massive datasets, ranging from gigabytes to petabytes. It can effortlessly scale its processing power to accommodate the growing needs of your organization, ensuring fast and reliable query performance even as your data volumes increase.
- **Speed:** With its distributed architecture and optimized query execution, BigQuery enables high-speed data analysis. It can process complex queries in seconds or minutes, allowing for near real-time insights and faster decision-making.
- **Serverless and Managed:** BigQuery is a fully managed service, so you don't have to worry about infrastructure provisioning, software updates, or maintenance. Google takes care of the underlying infrastructure, ensuring high availability and freeing up your team's time to focus on data analysis.
- **Cost-effective:** BigQuery follows a pay-as-you-go pricing model, where you only pay for the storage used and the data processed. There are no upfront costs or long-term commitments, making it a cost-effective choice for organizations of all sizes.
- **Integration with Google Cloud ecosystem:** BigQuery seamlessly integrates with other Google Cloud services, such as Google Analytics, Google Cloud Storage, and Google Data Studio.

## Getting Started with Google BigQuery
Getting started with Google BigQuery is user-friendly because it is a cloud service, and you don’t have to install any software. To get started with Google BigQuery, follow the steps below.

**Step 1:** To get started with Google BigQuery, navigate to Google Cloud Platform and click the console button on the top right side of the page.
<br />
![Google Cloud Platform Homepage.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q739522jvpsnt5pbbu6a.png)
<figure><figcaption>Google Cloud Platform Homepage.</figcaption></figure>
<br />

**Step 2:** Complete the steps that follow, and you will be redirected to create a project by clicking the Create Project button.
<br />
![Clicking the Create Project Button in Google BigQuery.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/phtvr7sznok82of673mb.png)
<figure><figcaption>Clicking the Create Project Button in Google BigQuery.</figcaption></figure>
<br />

**Step 3:** Next, give your project a name and click the create button to create your project.
<br />
![Giving the project a name in Google BigQuery.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57dxau7ei6eqm5i1jejv.png)
<figure><figcaption>Giving the project a name in Google BigQuery.</figcaption></figure>
<br />

**Step 4: **After that, create a BigQuery dataset by opening the hamburger menu beside your project and clicking the Create dataset button.
<br />
![Creating a BigQuery dataset in Google BigQuery.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t78hop3t55dl9fbf6160.png)
<figure><figcaption>Creating a BigQuery dataset in Google BigQuery.</figcaption></figure>
<br />

**Step 5:** You will then be prompted to add a dataset id and select a data location. After that, click the Create Dataset button.
<br />
![Adding dataset id and selecting a data location.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kn8m0mjy7ieisrvpl3kp.png)
<figure><figcaption>Adding dataset id and selecting a data location.</figcaption></figure>
<br />

A new dataset is created in your project and you can click it to open it.
<br />
![The created dataset in Google BigQuery.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/04p7l6xvd0u0v354dtzx.png)
<figure><figcaption>The created dataset in Google BigQuery.</figcaption></figure>
<br />

## Adding data into Google BigQuery
Let us add a supermarkets' stores dataset CSV file as the data source into Google BigQuery. You can download it by navigating to this [Kaggle web page](https://www.kaggle.com/datasets/surajjha101/stores-area-and-sales-data?resource=download).
<br />
![Supermarkets stores' dataset in Kaggle.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rjze7uj7213v6r4iyaip.png)
<figure><figcaption>Supermarkets stores' dataset in Kaggle.</figcaption></figure>
<br />

To add data into Google BigQuery, follow the steps below.

**Step 1:** On the Google Cloud Platform, open the dataset you created earlier and click the Create Table button.
<br />
![Opening the dataset and clicking the Create Table button.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/23cyk2i1rwdlb1idoh7h.png)
<figure><figcaption>Opening the dataset and clicking the Create Table button.</figcaption></figure>
<br />

**Step 2:** After that, you will be prompted to add a data source. In the Create Table From field, select the Upload option.
<br />
![Selecting the upload option for the Create Table from a field.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/usuw0hj3lrhm3lsu6xzy.png)
<figure><figcaption>Selecting the upload option for the Create Table from a field.
</figcaption></figure>
<br />

**Step 3:** Next, click the Browse button, and navigate to where the supermarkets’ stores dataset CSV file was saved, and select it.

![Clicking the browse button to select dataset CSV file.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n2detfdqgyb40fko5d2d.png)
<figure><figcaption>Clicking the browse button to select dataset CSV file.</figcaption></figure>
<br />

**Step 4:** Give the table data a name in the destination section.
<br />
![Giving table a name in Google BigQuery.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9z3u3djby0rftgvdva3k.png)
<figure><figcaption>Giving table a name in Google BigQuery.</figcaption></figure>
<br />

**Step 5:** After that, check the Auto detect checkbox to generate schema automatically once the table is created. Then click the Create Table button to create the table.
<br />
![Checking the auto detect checkbox and creating a table.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x87uihp23w6kdedaxdmc.png)
<figure><figcaption>Checking the auto detect checkbox and creating a table.</figcaption></figure>
<br />

Once the table is created, you can view the supermarkets’ stores data under the preview tab.
<br />
![Supermarkets Stores data in Google BigQuery.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n4ou05rgoztra1vgfpkb.png)
<figure><figcaption>Supermarkets Stores data in Google BigQuery.</figcaption></figure>
<br />

Next, we need to query and visualize data in Google BigQuery using [DbVisualizer](https://www.dbvis.com/eval/), a database SQL client.

## Connecting Google BigQuery With DbVisualizer
DbVisualizer is a universal database tool that provides a user-friendly interface for working with different database management systems (DBMS). It includes everything you need to develop, connect and manage your BigQuery database. It supports BigQuery-specific object types and everything else that makes BigQuery great.

To install DbVisualizer, navigate to the [DbVisualizer download page](https://www.dbvis.com/download/). Then download the recommended installer for your operating system. After that, execute the installer you downloaded and follow the instructions.

Follow [the user guide here](https://confluence.dbvis.com/display/UG232/) to learn how to get started with DbVisualizer. Once DbVisualizer is installed and running on your computer, follow the steps below to connect it with Google BigQuery.

**Step 1:** On DbVisualizer, click Create a Connection button as shown below.
<br />
![Clicking create a connection button in DbVisualizer.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q6wj4ur6cxjh5h599aqf.png)
<figure><figcaption>Clicking create a connection button in DbVisualizer.</figcaption></figure>
<br />

**Step 2:** Search and double-tap the **Google BigQuery driver** from the popup menu on the left side of your screen, as shown below.
<br />
![Searching Google BigQuery driver in DbVisualizer.
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iwrsqq5bes1i8x4tbxdq.png)
<figure><figcaption>Searching Google BigQuery driver in DbVisualizer.</figcaption></figure>
<br />

An object view tab for the Google BigQuery connection is opened.
<br />
![Object view tab for the Google BigQuery connection.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3tkwou2chqwhfdo6ey2g.png)
<figure><figcaption>Object view tab for the Google BigQuery connection.</figcaption></figure>
<br />

**Step 3:** In the connection tab, select Connection Type as OAuth 1.
<br />
![Selecting Connection Type as OAuth 1 in DbVisualizer.
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6utcggkx0mahf671mgw.png)
<figure><figcaption>Selecting Connection Type as OAuth 1 in DbVisualizer.</figcaption></figure>
<br />

**Step 4:** Navigate back to Google BigQuery, get your project Id, and add it to the Project Id field on the connection tab.
<br />
![Adding Google BigQuery project id in DbVisualizer.
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y6bnpjdxb8acw49cnogs.png)
<figure><figcaption>Adding Google BigQuery project id in DbVisualizer.</figcaption></figure>
<br />

**Step 5:** Click the Connect button in the connection tab and the Google BigQuery driver will pop-up a dialog where you can obtain a URL.
<br />
![Google BigQuery driver pop up dialog in DbVisualizer.
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/khaegrw0qh0xixhtn4nx.png)
<figure><figcaption>Google BigQuery driver pop up dialog in DbVisualizer.</figcaption></figure>
<br />

**Step 6:** Copy the URL into a browser and log in via Google. You will get a token string that you can paste into the same dialog where you copied the URL. After that, Click the OK button on the dialog to establish a connection.
<br />
![Viewing data on Google BigQuery in DbVisualizer.
](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/efycsqrd3xhzosd9aph6.png)
<figure><figcaption>Viewing data on Google BigQuery in DbVisualizer.</figcaption></figure>
<br />

You’ve now established a connection between DbVisualizer and Google BigQuery!

## Querying Data In Google BigQuery Using DbVisualizer

To run a query on data in Google BigQuery using DbVisualizer, follow the steps below.

**Step 1:** Press the (Ctrl+T) keys to open a SQL editor.
<br />
![SQL editor in DbVisualizer.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sdym1miakrr603wlcwrw.png)
<figure><figcaption>SQL editor in DbVisualizer.</figcaption></figure>
<br />

**Step 2: **Enter the SQL query below into the SQL editor and then press the (Ctrl+Enter) keys to run the query. The query determines the top 10 stores by sales from the stores' data on Google BigQuery.

```
SELECT BigQueryDemoTable.Store_ID_, BigQueryDemoTable.Store_Sales AS Sales
FROM biqquerydemo1.BigQueryDemoDataset.BigQueryDemoTable
GROUP BY BigQueryDemoTable.Store_ID_, BigQueryDemoTable.Store_Sales
ORDER BY BigQueryDemoTable.Store_Sales
DESCLIMIT 10
```

The SQL query results are shown in a table with two columns of **Store_ID** and **Sales**.
<br />
![SQL query results in DbVisualizer.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/w6zvjob60gfci20zx8sh.png)
<figure><figcaption>SQL query results in DbVisualizer.</figcaption></figure>
<br />

## Visualizing Data In Google BigQuery Using DbVisualizer
When using DbVisualizer, you can present data from any table in a configurable chart displayed in a line, bar, area, or pie chart. The charting support is similar to that of MsExcel. The charts can be exported as an image to file, printed, or copied to the system clipboard for easy sharing.

To activate the chart view, click the rightmost button in the result toolbar, as shown below.
<br />
![Activating chart view in DbVisualizer.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j2fx72ot2bfoy2wjvjzh.png)
<figure><figcaption>Activating chart view in DbVisualizer.</figcaption></figure>
<br />

In the chart, select Store_ID as the X-axis and Sales as the Y-axis, as shown below.
<br />
![A chart in DbVisualizer.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kj1u9d0zm5wlxmst4hde.png)
<figure><figcaption>A chart in DbVisualizer.</figcaption></figure>
<br />

See how easy everything is? Why not [try DbVisualizer today](https://www.dbvis.com/eval/)?

## Conclusion
In conclusion, Google BigQuery is a powerful and efficient cloud-based data warehouse provided by Google Cloud to offer a scalable and cost-effective solution for businesses to store, query, and analyze large volumes of data.

Google BigQuery can also work in conjunction with multiple types of software solutions like SQL clients, and SQL clients like [DbVisualizer](https://www.dbvis.com/) can help query and visualize the data existing in the service.

We hope that you’ve found this blog useful - make sure to [follow our blog for updates and news in the database space](https://www.dbvis.com/thetable/) until next time.


## About the author

Bonnie is a web developer and technical writer creating easy-to-understand technical articles.