0
0
Google Sheetsspreadsheet~20 mins

QUERY function basics in Google Sheets - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
QUERY Function Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
📊 Formula Result
intermediate
2:00remaining
Output of QUERY with simple SELECT
Given a table in range A1:B5 with headers in row 1:

A1: Name
A2: Alice
A3: Bob
A4: Carol
A5: Dave

B1: Score
B2: 85
B3: 90
B4: 78
B5: 92

What is the output of this formula?

=QUERY(A1:B5, "SELECT A")
AName<br>Alice<br>Bob<br>Carol<br>Dave
BAlice<br>Bob<br>Carol<br>Dave
CScore<br>85<br>90<br>78<br>92
DName<br>Score
Attempts:
2 left
💡 Hint
Remember QUERY includes headers by default.
📊 Formula Result
intermediate
2:00remaining
Filtering rows with QUERY
Using the same table as before, what is the output of this formula?

=QUERY(A1:B5, "SELECT A, B WHERE B > 80")
AName | Score<br>Alice | 85<br>Bob | 90<br>Dave | 92
BName | Score<br>Bob | 90<br>Carol | 78<br>Dave | 92
CAlice | 85<br>Bob | 90<br>Dave | 92
DName | Score<br>Alice | 85<br>Bob | 90<br>Carol | 78<br>Dave | 92
Attempts:
2 left
💡 Hint
Look for scores greater than 80 only.
Function Choice
advanced
2:00remaining
Choosing correct QUERY to sort data
You want to list all names and scores sorted by score descending from the same table.
Which QUERY formula will do this correctly?
A=QUERY(A1:B5, "SELECT A, B ORDER BY A DESC")
B=QUERY(A1:B5, "SELECT A, B SORT BY B DESC")
C=QUERY(A1:B5, "SELECT A, B ORDER BY B DESC")
D=QUERY(A1:B5, "SELECT A, B ORDER B DESC")
Attempts:
2 left
💡 Hint
The correct syntax uses ORDER BY to sort.
data_analysis
advanced
2:00remaining
Counting rows with QUERY
Using the same table, which QUERY formula returns the number of students with scores above 80?
A=QUERY(A1:B5, "SELECT COUNT(B) LABEL COUNT(B) 'Count' WHERE B > 80")
B=QUERY(A1:B5, "SELECT COUNT(A) WHERE B > 80")
C=QUERY(A1:B5, "SELECT COUNT(B) GROUP BY B > 80")
D=QUERY(A1:B5, "SELECT COUNT(B) WHERE B > 80")
Attempts:
2 left
💡 Hint
COUNT counts non-empty cells in the selected column.
🎯 Scenario
expert
3:00remaining
Extracting unique names with QUERY
You have a table with duplicate names in column A and scores in column B. You want to get a list of unique names only.
Which QUERY formula will produce a list of unique names including the header?
A=QUERY(A1:B10, "SELECT UNIQUE(A)")
B=QUERY(A1:B10, "SELECT A GROUP BY A")
C=QUERY(A1:B10, "SELECT A WHERE A IS UNIQUE")
D=QUERY(A1:B10, "SELECT A LABEL A 'Unique Names'")
Attempts:
2 left
💡 Hint
Use GROUP BY to get unique values in QUERY.