0
0
GCPcloud~10 mins

BigQuery SQL and pricing model 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 the table named 'sales_data'.

GCP
SELECT [1] FROM `project.dataset.sales_data`;
Drag options to blanks, or click blank then click option'
A*
BALL
Cdata
Dcolumns
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*'
Trying to write 'columns' literally
2fill in blank
medium

Complete the code to filter rows where the 'amount' column is greater than 100.

GCP
SELECT * FROM `project.dataset.sales_data` WHERE amount [1] 100;
Drag options to blanks, or click blank then click option'
A=
B<
C>
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which means less than
Using '=' which means equal
3fill in blank
hard

Fix the error in the code to calculate the total sales by summing the 'amount' column.

GCP
SELECT SUM([1]) AS total_sales FROM `project.dataset.sales_data`;
Drag options to blanks, or click blank then click option'
Aamount
Bprice
Ctotal
Dsales
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name that does not exist
Using 'price' or 'total' which are not columns here
4fill in blank
hard

Fill both blanks to create a query that groups sales by 'region' and counts the number of sales.

GCP
SELECT [1], COUNT(*) AS sales_count FROM `project.dataset.sales_data` GROUP BY [2];
Drag options to blanks, or click blank then click option'
Aregion
Bamount
Cdate
Dcustomer_id
Attempts:
3 left
💡 Hint
Common Mistakes
Grouping by a different column than selected
Using columns unrelated to grouping
5fill in blank
hard

Fill all three blanks to write a query that selects 'customer_id', sums 'amount' as 'total_spent', and filters customers who spent more than 500.

GCP
SELECT [1], SUM([2]) AS total_spent FROM `project.dataset.sales_data` GROUP BY [3] HAVING total_spent > 500;
Drag options to blanks, or click blank then click option'
Acustomer_id
Bamount
Dregion
Attempts:
3 left
💡 Hint
Common Mistakes
Using different columns for select and group by
Summing the wrong column