Challenge - 5 Problems
Master of Standard Comparison Operators
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate1:00remaining
Output of a simple equality comparison
What is the output of this SQL query?
SELECT 5 = 5 AS result;PostgreSQL
SELECT 5 = 5 AS result;
Attempts:
2 left
💡 Hint
The '=' operator checks if two values are equal and returns a boolean.
✗ Incorrect
The '=' operator compares two values. Since 5 equals 5, the result is true.
❓ query_result
intermediate1:30remaining
Result of greater than comparison in WHERE clause
Given a table
Assuming the table has values: 5, 10, 15, 20.
numbers with a column value, what rows will this query return?SELECT value FROM numbers WHERE value > 10;Assuming the table has values: 5, 10, 15, 20.
PostgreSQL
SELECT value FROM numbers WHERE value > 10;
Attempts:
2 left
💡 Hint
The '>' operator selects values strictly greater than 10.
✗ Incorrect
Only values greater than 10 are 15 and 20, so those rows are returned.
📝 Syntax
advanced1:30remaining
Identify the syntax error in comparison
Which option contains a syntax error in using comparison operators in PostgreSQL?
Attempts:
2 left
💡 Hint
Check the order of symbols in the comparison operator.
✗ Incorrect
The operator '=!' is invalid. The correct not equal operators are '<>' or '!='.
❓ query_result
advanced1:00remaining
Output of combined comparison with AND
What is the output of this query?
SELECT (5 > 3) AND (2 = 2) AS result;PostgreSQL
SELECT (5 > 3) AND (2 = 2) AS result;
Attempts:
2 left
💡 Hint
Both comparisons must be true for AND to return true.
✗ Incorrect
5 > 3 is true and 2 = 2 is true, so true AND true is true.
❓ query_result
expert1:30remaining
Understanding NULL in comparison operators
What is the result of this query?
SELECT NULL = NULL AS result;PostgreSQL
SELECT NULL = NULL AS result;
Attempts:
2 left
💡 Hint
In SQL, NULL means unknown, so comparing NULL to NULL is not true or false.
✗ Incorrect
Comparing NULL to NULL returns NULL because NULL represents an unknown value, so equality is unknown.