SQLCASEtutorial

What is CASE WHEN in SQL? Conditional logic for beginners

CASE WHEN is "if/else inside SQL". Plain words: how to put conditions right into SELECT, the difference between searched CASE and simple CASE, bucketing numbers into categories, pivoting with one formula, and conditional aggregates. With tables and common pitfalls.

1 min de lectureSQL · CASE · tutorial

CASE WHEN is "if/else inside a SQL query". The way to put a condition right in SELECT, UPDATE, or WHERE and get one of several values depending on the row.

This article is currently in Russian. The full English translation is on the way.

Entraînez-vous sur de vrais exercices

Résolvez des exercices dans l'entraîneur SQL avec évaluation et indices instantanés.

Ouvrir l'entraîneur