
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
Identify duplicate rows
/ 30
Write basic SQL on ecommerce data
/ 70
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.
We have a newly available ecommerce dataset that has millions of Google Analytics records for the Google Merchandise Store loaded into a table in BigQuery. In this lab, you use a copy of that dataset. Sample scenarios are provided, from which you look at the data and ways to remove duplicate information. The lab then steps you through further analysis the data.
To follow and experiment with the BigQuery queries provided to analyze the data, see the BigQuery Query Syntax Reference.
In this lab, you use BigQuery to:
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.
In this section, you add the data-to-insights project to your environment resources.
The Welcome to BigQuery in the Cloud Console message box opens.
BigQuery public datasets are not displayed by default in the BigQuery web UI. To open the public datasets project, copy "data-to-insights".
data-to-insights
. Click STAR.The Explorer section now lists the data-to-insights project.
Scenario: Your data analyst team exported the Google Analytics logs for an ecommerce website into BigQuery and created a new table of all the raw ecommerce visitor session data.
Explore the all_sessions_raw
table data:
In the right pane, a section opens that provides 3 views of the table data:
Questions:
Seeing a sample amount of data may give you greater intuition for what is included in the dataset.
To preview sample rows from the table without using SQL, click the preview tab.
Scan and scroll through the rows. There is no singular field that uniquely identifies a row, so you need advanced logic to identify duplicate rows.
The query you'll use (below) uses the SQL GROUP BY
function on every field and counts (COUNT
) where there are rows that have the same values across every field:
COUNT
returns 1 as there are no other groupings of rows with the exact same value for all fields.COUNT
will be greater than 1.The last part of the query is an aggregation filter using HAVING
to only show the results that have a COUNT
of duplicates greater than 1. Therefore, the number of records that have duplicates will be the same as the number of rows in the resulting table.
Click Check my progress to verify the objective.
In this section, you use a deduplicated table called all_sessions
.
Scenario: Your data analyst team has provided you with this query, and your schema experts have identified the key fields that must be unique for each record per your schema.
all_sessions
table:The query returns zero records.
GROUP BY 1
instead of GROUP BY fullVisitorId
.In this section, you query for insights on the ecommerce dataset.
Your query determines the total views by counting product_views
and the number of unique visitors by counting fullVisitorID
.
Results:
fullVisitorID
) by the referring site (channelGrouping
):Results:
v2ProductName
) alphabetically:Tip: In SQL, the ORDER BY clauses defaults to Ascending (ASC) A to Z. If you want the reverse, try ORDER BY field_name DESC.
Results:
This query returns a total of 633 products (rows).
product_views
) from all visitors (including people who have viewed the same product more than once). Your query counts number of times a product (v2ProductName
) was viewed (product_views
), puts the list in descending order, and lists the top 5 entries:Tip: In Google Analytics, a visitor can "view" a product during the following interaction types: 'page', 'screenview', 'event', 'transaction', 'item', 'social', 'exception', 'timing'. For our purposes, simply filter for only type = 'PAGE'.
Results:
Tip: You can use the SQL WITH
clause to help break apart a complex query into multiple steps. Here we first create a query that finds each unique product per visitor and counts them once. Then the second query performs the aggregation across all visitors and products.
Results:
productQuantity
):Results:
Questions:
SUM(productQuantity)
/COUNT(productQuantity)
):Results
Question:
The 22 oz YouTube Bottle Infuser had the highest avg_per_order with 9.38 units per order.
Click Check my progress to verify the objective.
Congratulations! In this lab, you used BigQuery to view and query data to gain meaningful insight on various aspects of product marketing. You learned how to access an ecommerce dataset, look at the dataset metadata, remove duplicate entries, and write and execute queries.
...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 April 02, 2024
Lab Last Tested April 02, 2024
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