Skip to main content
SQL Code Completion Medium +20 XP

CASE Expression

Complete the CASE expression.

SQLFill in the blank
SELECT name,
  ___ WHEN salary > 80000 THEN 'Senior'
       WHEN salary > 50000 THEN 'Mid'
       ELSE 'Junior' END AS level
FROM employees;

Type the missing code

Show answer and explanation

Answer: CASE

CASE is SQL's conditional expression. It evaluates conditions in order and returns the first matching result.

Hint: What keyword starts a conditional expression in SQL?

What this challenge tests

Code Completion in SQL: case, expressions.

Related challenges