This Unsolved CASE puzzle asks you to predict its result before execution. The preceding bitwise challenge drew more than 125 responses.

SELECT CASE WHEN 1 <> 1 THEN 1 WHEN 2 <> 2 THEN 2 END AS Result;Explain what happens when neither WHEN condition matches and no ELSE appears. Study the query before checking its output. A controlled execution can test your reasoning afterward.
Leave your result and explanation in the comments. The challenge remains open without a spoiler. The earlier puzzle and short-video resources provide context.
Related reading
- SQL Puzzle – SELECT ~ 1 : Guess the Answer
- SQL in Sixty Seconds video
- Find Expensive Queries – SQL in Sixty Seconds #159
- Case-Sensitive Search – SQL in Sixty Seconds #158
- Wait Stats for Performance – SQL in Sixty Seconds #157
- Multiple Backup Copies Stripped – SQL in Sixty Seconds #156
A predicted expression result is not a tested explanation, it is reasoning to compare with the stated input and rules.
Published by Pinal Dave on SQLAuthority. More of my work at pinaldave.com.
Discover more from SQL Authority with Pinal Dave
Subscribe to get the latest posts sent to your email.





12 Comments. Leave new
Ok I guessed the answer correctly. If 1 does not = 1 then 1 / if 2 does not = 2 then 2. Both are false statements and there is no Else statement therefore no value so null is returned in the column named “Result”
NULL because case conditions can’t evaluate to true
NULL
NULL as CASE Conditions are not returning TRUE
Null because none of the statements are true
NULL as because none of the conditions are true
The following query will create a column and will display the column name as result if the when statement is true which is if 1 is not equal to 1 and 2 is also not equal to 2 in second statement only then in the result column first row will display as 1 and second row will display as 2.
null because the query wasn’t close using the ;
It wouldn’t run because there is no column from where the case statement would work on.
There’s no column indicated after the Case statement or when given the condition.
NULL
FROM keyword not found where expected
The output of the SELECT statement you provided would be NULL.
In this case, the first WHEN condition 1 1 evaluates to False because 1 is equal to 1. Therefore, the corresponding THEN expression is not executed. The second WHEN condition 2 2 also evaluates to False because 2 is equal to 2. As there is no ELSE clause specified, and neither of the WHEN conditions is true, the result would be NULL.
The output column is labeled as ‘Result’ in the SELECT statement, but since no value is assigned to it, the result would be NULL for all rows returned.