0Pricing
SQL Academy · Lesson

Bucketing and Labeling Data

Turn values into categories.

What Is Bucketing?

Bucketing means grouping raw values into named categories — turning numbers, dates, or codes into human-readable labels.

Instead of showing a score of 87, you show "Good". Instead of showing an age of 14, you show "Teen". The CASE expression is your main tool for this.

Sample Table: Orders

We will use an orders table throughout this lesson. Each row has an order amount and a status code.

Run the query below to see the data we are working with.

SELECT id, customer, amount, status
FROM orders
ORDER BY id;

All lessons in this course

  1. The CASE Expression
  2. Searched vs Simple CASE
  3. Bucketing and Labeling Data
  4. CASE in ORDER BY and Aggregates
← Back to SQL Academy