0
0
PostgreSQLquery~10 mins

Standard comparison operators 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 rows where age is equal to 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 '!=' instead of '=' will select rows where age is not 30.
2fill in blank
medium

Complete the code to select rows where salary is greater than 50000.

PostgreSQL
SELECT * FROM employees WHERE salary [1] 50000;
Drag options to blanks, or click blank then click option'
A>
B<
C=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' will select salaries less than 50000, which is incorrect here.
3fill in blank
hard

Fix the error in the code to select rows where score is not equal to 100.

PostgreSQL
SELECT * FROM results WHERE score [1] 100;
Drag options to blanks, or click blank then click option'
A>
B=
C<
D!=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' will select rows where score equals 100, which is wrong here.
4fill in blank
hard

Complete the code to select rows where price is less than or equal to 100.

PostgreSQL
SELECT * FROM products WHERE price [1] 100;
Drag options to blanks, or click blank then click option'
A>=
B<=
C<
D>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' only excludes price equal to 100, which is not correct here.
5fill in blank
hard

Fill both blanks to select rows where quantity is greater than 10 and less than 50.

PostgreSQL
SELECT * FROM inventory WHERE quantity [1] 10 AND quantity [2] 50;
Drag options to blanks, or click blank then click option'
A>
B<
C;
D=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of '<' or '>' will include unwanted values.