Brightlane's operations team is auditing the order pipeline and wants to see what status values are currently in use across the platform.
Write a query to return each status value that appears in the orders table, with no duplicates.
Assumptions:
- The
orderstable contains every order Brightlane has processed. - The
statuscolumn records each order's current stage; the same status appears on many orders.
Output:
- One row per distinct status value, with a single column
status.
Schema · ecommerce 5 tables
Run previews · Check grades
Write a query, then run it to see results here.
Worked solution Try it yourself first
SELECT DISTINCT
status
FROM
orders The shape
DISTINCT status collapses a column that repeats across thousands of orders down to its four real values: delivered, cancelled, pending, shipped. That's the entire active value space of the order pipeline, on one screen.
Clause by clause
SELECT DISTINCT statusreturns the unique values of thestatuscolumn.DISTINCTdeduplicates whatever the SELECT list produces; with a single column, the deduplication is one-dimensional — two rows are duplicates whenever theirstatusmatches.FROM ordersis the row source. Every order Brightlane has processed contributes itsstatusvalue to the candidate set, and the deduplication runs across that whole set.
The pattern is the daily move for the first five minutes with a table you don't know yet. Before writing any filter or join, run SELECT DISTINCT col FROM table on each categorical column to learn the value space. Four values means a tight pipeline with no orphan statuses sneaking in; a fifth value showing up later would mean a new stage in the workflow that the rest of the queries probably haven't accounted for.
You practiced using DISTINCT to discover the active value space of a categorical column. "What values exist" is the everyday data-exploration question — SELECT DISTINCT col FROM table is the one-line answer that scales from four values to four hundred.