0
0
PostgreSQLquery~10 mins

Why filtering behavior 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 rows where the age is greater than 30.

PostgreSQL
SELECT * FROM users 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 '<' will select ages less than 30, which is wrong.
Using '=' will select only age exactly 30, not greater.
2fill in blank
medium

Complete the code to filter users whose name starts with 'A'.

PostgreSQL
SELECT * FROM users WHERE name [1] 'A%';
Drag options to blanks, or click blank then click option'
ALIKE
B=
CILIKE
DIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' will look for exact match 'A%', not pattern.
Using IN is for lists, not patterns.
3fill in blank
hard

Fix the error in the query to filter users with age not equal to 25.

PostgreSQL
SELECT * FROM users WHERE age [1] 25;
Drag options to blanks, or click blank then click option'
A<>
B!=
C==
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '==' causes syntax error.
Using '=' selects equal values, not 'not equal'.
4fill in blank
hard

Fill both blanks to select users with age between 20 and 30 inclusive.

PostgreSQL
SELECT * FROM users WHERE age [1] 20 AND age [2] 30;
Drag options to blanks, or click blank then click option'
A>=
B<
C<=
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' or '<' excludes boundary ages 20 or 30.
Mixing operators incorrectly causes wrong filtering.
5fill in blank
hard

Fill all three blanks to select users whose name starts with 'J', age is greater than 25, and city is not 'London'.

PostgreSQL
SELECT * FROM users WHERE name [1] 'J%' AND age [2] 25 AND city [3] 'London';
Drag options to blanks, or click blank then click option'
ALIKE
B>
C!=
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '!=' for city filters wrong rows.
Using '=' instead of LIKE for name pattern causes no matches.