
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Create a new dataset to store the tables
/ 25
Explore the product sentiment dataset
/ 25
Join datasets to find insights
/ 25
Append additional records
/ 25
BigQuery is Google's fully managed, NoOps, low cost analytics database. With BigQuery you can query terabytes and terabytes of data without having any infrastructure to manage or needing a database administrator. BigQuery uses SQL and can take advantage of the pay-as-you-go model. BigQuery allows you to focus on analyzing data to find meaningful insights.
The dataset you'll use is an ecommerce dataset that has millions of Google Analytics records from the Google Merchandise Store. You will explore the available fields and row for insights.
This lab focuses on how to create new reporting tables using SQL JOINS and UNIONs.
Scenario: Your marketing team provided you and your data science team all of the product reviews for your ecommerce website. You are partnering with them to create a data warehouse in BigQuery which joins together data from three sources:
In this lab, you learn how to perform these tasks:
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).
The lab spins up resources, and then opens another tab that shows the Sign in page.
Tip: Arrange the tabs in separate windows, side-by-side.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
The Welcome to BigQuery in the Cloud Console message box opens. This message box provides a link to the quickstart guide and the release notes.
The BigQuery console opens.
To get started, create a new dataset titled ecommerce in BigQuery to store your tables.
In the left pane, click on the name of your BigQuery project (qwiklabs-gcp-xxxx
).
Click on the three dots next to your project name, then select Create dataset.
The Create dataset dialog opens.
Set the Dataset ID to ecommerce
, leave all other options at their default values.
Click Create dataset.
Click Check my progress to verify the objective.
Your data science team has run all of your product reviews through the API and provided you with the average sentiment score and magnitude for each of your products.
The project with your marketing team's dataset is data-to-insights. BigQuery public datasets are not displayed by default in BigQuery. The queries in this lab will use the data-to-insights
dataset even though you cannot see it.
data-to-insights
project.products
table.Possible solution:
Possible solution:
What is the product with the lowest sentiment?
Click Check my progress to verify the objective.
Scenario: It's the first of the month and your inventory team has informed you that the orderedQuantity
field in the product inventory dataset is out of date. They need your help to query the total sales by product for 08/01/2017 and reference that against the current stock levels in inventory to see which products need to be resupplied first.
sales_by_sku_20170801
data-to-insights.ecommerce.all_sessions_raw
productSKU
productQuantity
). Hint: Use a SUM() with a IFNULL
condition20170801
ORDER BY
the SKUs with the most orders firstPossible solution:
sales_by_sku
table, then click the Preview tab.How many distinct product SKUs were sold?
Answer: 462
Next, enrich your sales data with product inventory information by joining the two datasets.
name
stockLevel
restockingLeadTime
sentimentScore
sentimentMagnitude
Possible solution:
total_ordered / stockLevel
) and alias it "ratio
". Hint: Use SAFE_DIVIDE(field1,field2)
to avoid dividing by 0 errors when the stock level is 0.Possible solution:
Click Check my progress to verify the objective.
Your international team has already made in-store sales on 08/02/2017 which you want to record in your daily sales tables.
ecommerce.sales_by_sku_20170802
productSKU STRING
total_ordered
as an INT64
fieldPossible solution:
There are multiple ways to append together data that has the same schema. Two common ways are using UNIONs and table wildcards.
ecommerce.sales_by_sku_20170801
ecommerce.sales_by_sku_20170802
UNION
and UNION ALL
is that a UNION
will not include duplicate records.What is a pitfall of having many daily sales tables? You will have to write many UNION
statements chained together.
A better solution is to use the table wildcard filter and _TABLE_SUFFIX
filter.
ecommerce.sales_by_sku_
for the year 2017.Possible solution:
Possible solution:
Click Check my progress to verify the objective.
You explored sample ecommerce data by creating reporting tables and then manipulating views using SQL JOINs and UNIONs.
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated February 3, 2024
Lab Last Tested October 31, 2023
Copyright 2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.
This content is not currently available
We will notify you via email when it becomes available
Great!
We will contact you via email if it becomes available
One lab at a time
Confirm to end all existing labs and start this one