Skip to content
We areTOP 1%

Triangle Judgement

EasyLeetCodeSQL: CASE, String & Date Functions
Solve on LeetCode(opens in a new tab)
Track your progress
First attempt
Re-solve after a few days
Final pass before interviews
Hint and exampleShow

Produce a label for each row with a CASE expression whose condition checks all the required comparisons at once.

Example: marks(student, theory, practical) — pass only if both are at least 40

student | theory | practical
Asha    | 55     | 48
Ravi    | 62     | 30
SELECT student,
       CASE WHEN theory >= 40 AND practical >= 40
            THEN 'Pass' ELSE 'Fail' END AS result
FROM marks;   -- Asha | Pass, Ravi | Fail

More in SQL: CASE, String & Date Functions

Sign in to track your progress

Your checkboxes, streak and activity heatmap are saved to your account and sync across devices. It is free.
Sign in with email

New here? Create an account