0
0
PostgreSQLquery~10 mins

BETWEEN for range filtering in PostgreSQL - 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 products with prices between 10 and 50.

PostgreSQL
SELECT * FROM products WHERE price [1] 10 AND 50;
Drag options to blanks, or click blank then click option'
AIN
B=
C>=
DBETWEEN
Attempts:
3 left
💡 Hint
Common Mistakes
Using IN instead of BETWEEN for range filtering.
Using '=' which checks for exact match, not a range.
2fill in blank
medium

Complete the code to find employees hired between 2010 and 2015.

PostgreSQL
SELECT name FROM employees WHERE hire_date [1] '2010-01-01' AND '2015-12-31';
Drag options to blanks, or click blank then click option'
ABETWEEN
B>
CIN
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using IN which checks for specific values, not a range.
Using > or < alone which excludes one boundary.
3fill in blank
hard

Fix the error in the query to select orders with amounts between 100 and 500.

PostgreSQL
SELECT * FROM orders WHERE amount [1] 100 AND 500;
Drag options to blanks, or click blank then click option'
A>
BBETWEEN
CBETWEEN AND
DIN
Attempts:
3 left
💡 Hint
Common Mistakes
Using a comma instead of AND between the range values.
Using IN which expects a list, not a range.
4fill in blank
hard

Fill both blanks to select customers with age between 18 and 30.

PostgreSQL
SELECT * FROM customers WHERE age [1] 18 [2] 30;
Drag options to blanks, or click blank then click option'
ABETWEEN
BAND
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using > or < instead of BETWEEN and AND.
Omitting the AND keyword between the range values.
5fill in blank
hard

Fill all three blanks to select products with quantity between 5 and 20.

PostgreSQL
SELECT * FROM inventory WHERE quantity [1] [2] [3] 20;
Drag options to blanks, or click blank then click option'
ABETWEEN
BAND
C20
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the order of the numbers.
Using commas instead of AND.
Omitting the BETWEEN keyword.