Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to select all columns from the users table.
PostgreSQL
SELECT [1] FROM users; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'columns' instead of the symbol *.
Leaving the SELECT statement incomplete.
✗ Incorrect
The asterisk (*) means select all columns from the table.
2fill in blank
mediumComplete the code to filter users with age greater than 18.
PostgreSQL
SELECT * FROM users WHERE age [1] 18;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which means less than.
Using '=' which means equal to.
✗ Incorrect
The '>' operator filters for ages greater than 18.
3fill in blank
hardFix the error in the query to count users by country.
PostgreSQL
SELECT country, COUNT([1]) FROM users GROUP BY country; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Counting a specific column that might have nulls, leading to wrong counts.
Using the grouping column inside COUNT which is not typical.
✗ Incorrect
Using COUNT(*) counts all rows per country, which is correct here.
4fill in blank
hardFill both blanks to select names and ages of users older than 25.
PostgreSQL
SELECT [1], [2] FROM users WHERE age > 25;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting unrelated columns like 'country' or 'email'.
Selecting only one column instead of both.
✗ Incorrect
We select 'name' and 'age' columns to see users' names and ages.
5fill in blank
hardFill all three blanks to create a dictionary of user emails and their countries for users older than 30.
PostgreSQL
SELECT [1], [2] FROM users WHERE age [3] 30;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' for age comparison.
Selecting wrong columns like 'name' or 'age' instead of 'email' and 'country'.
✗ Incorrect
Select 'email' and 'country' columns and filter users with age greater than 30.