Lesson 3.1 · Pro
CASE WHEN: if-then logic in a column
Label rows, combine columns and set a custom sort order with CASE.
In this lesson
- Label rows with CASE WHEN
- Short form: CASE column WHEN value
- Use IN and LIKE inside CASE
- Build one column from two
- Sort in your own order
Go Pro to read this lesson
Pro unlocks every lesson and practice problem in SQL, Python, pandas and NumPy, with answers and step-by-step explanations.