0
0
SQLquery~10 mins

Searched CASE syntax in SQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a searched CASE expression.

SQL
SELECT CASE [1] END AS result FROM orders;
Drag options to blanks, or click blank then click option'
AWHEN amount > 100 THEN 'High'
BWHEN amount > 100 THEN 'High' ELSE 'Low'
Camount > 100
Damount
Attempts:
3 left
💡 Hint
Common Mistakes
Putting a condition directly after CASE without WHEN.
Using ELSE inside the first WHEN clause.
2fill in blank
medium

Complete the code to add an ELSE clause to the searched CASE.

SQL
SELECT CASE WHEN score >= 90 THEN 'A' [1] END AS grade FROM students;
Drag options to blanks, or click blank then click option'
AELSE 'B'
BWHEN score < 90 THEN 'F'
CELSE 'F'
DWHEN score < 60 THEN 'F'
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHEN instead of ELSE for the default case.
Omitting ELSE and expecting a default result.
3fill in blank
hard

Fix the error in the searched CASE by completing the missing WHEN clause.

SQL
SELECT CASE WHEN age < 18 THEN 'Minor' [1] END AS category FROM people;
Drag options to blanks, or click blank then click option'
AWHEN age = 18 THEN 'Adult'
BELSE 'Adult'
CWHEN age > 18 THEN 'Adult'
DWHEN age >= 18 THEN 'Adult'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ELSE instead of WHEN for the adult condition.
Using incorrect comparison operators.
4fill in blank
hard

Fill both blanks to complete the searched CASE that categorizes salary.

SQL
SELECT CASE [1] THEN 'High' [2] 'Low' END AS salary_level FROM employees;
Drag options to blanks, or click blank then click option'
AWHEN salary > 5000
BWHEN salary >= 5000
CELSE
DWHEN salary < 5000
Attempts:
3 left
💡 Hint
Common Mistakes
Using WHEN instead of ELSE for the default case.
Using >= instead of > in the first condition.
5fill in blank
hard

Fill both blanks to complete the searched CASE that assigns labels based on score ranges.

SQL
SELECT CASE [1] THEN 'Excellent' WHEN score >= 70 THEN 'Good' [2] 'Poor' END AS performance FROM results;
Drag options to blanks, or click blank then click option'
AWHEN score >= 90
BELSE
CWHEN score < 70
DWHEN score > 90
Attempts:
3 left
💡 Hint
Common Mistakes
Using > 90 instead of >= 90.
Omitting ELSE for the default case.