0
0
PostgreSQLquery~10 mins

Why server-side programming matters in PostgreSQL - Test Your Understanding

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 users table.

PostgreSQL
SELECT [1] FROM users;
Drag options to blanks, or click blank then click option'
A*
Ball
Ceverything
Dcolumns
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like 'all' or 'columns' instead of the symbol *.
Leaving the SELECT statement incomplete.
2fill in blank
medium

Complete 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'
A<
B<=
C=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which means less than.
Using '=' which means equal to.
3fill in blank
hard

Fix 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'
Auser_id
B*
Ccountry
Dage
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.
4fill in blank
hard

Fill 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'
Aname
Bage
Ccountry
Demail
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting unrelated columns like 'country' or 'email'.
Selecting only one column instead of both.
5fill in blank
hard

Fill 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'
Aemail
Bcountry
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' for age comparison.
Selecting wrong columns like 'name' or 'age' instead of 'email' and 'country'.