0
0
GCPcloud~10 mins

BigQuery for analytics in GCP - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all columns from a BigQuery table named 'sales_data'.

GCP
SELECT [1] FROM `project.dataset.sales_data`;
Drag options to blanks, or click blank then click option'
AEVERYTHING
B*
CCOLUMNS
DALL
Attempts:
3 left
💡 Hint
Common Mistakes
Using keywords like ALL or COLUMNS which are not valid in this context.
Trying to write out all column names manually.
2fill in blank
medium

Complete the code to count the number of rows in the 'users' table.

GCP
SELECT COUNT([1]) FROM `project.dataset.users`;
Drag options to blanks, or click blank then click option'
Aall
B1
Cuser_id
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using a specific column name which counts only non-null values in that column.
Using '1' or 'all' which are not valid in COUNT function.
3fill in blank
hard

Fix the error in the query to filter rows where 'age' is greater than 30.

GCP
SELECT * FROM `project.dataset.customers` WHERE age [1] 30;
Drag options to blanks, or click blank then click option'
A>
B=
C<
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' which filters only age exactly 30.
Using '<' or '<=' which filter smaller ages.
4fill in blank
hard

Fill both blanks to group sales by 'region' and calculate total revenue.

GCP
SELECT region, SUM([1]) AS total_revenue FROM `project.dataset.sales` GROUP BY [2];
Drag options to blanks, or click blank then click option'
Arevenue
Bregion
Csales
Dtotal
Attempts:
3 left
💡 Hint
Common Mistakes
Grouping by the wrong column.
Summing a column that does not represent revenue.
5fill in blank
hard

Fill all three blanks to select user_id, count orders, and filter users with more than 5 orders.

GCP
SELECT [1], COUNT([2]) AS order_count FROM `project.dataset.orders` GROUP BY [3] HAVING order_count > 5;
Drag options to blanks, or click blank then click option'
Auser_id
B*
Dorder_id
Attempts:
3 left
💡 Hint
Common Mistakes
Counting the wrong column.
Grouping by a column not selected.