Example 1
List unique status values
DISTINCT applies after the selected columns are evaluated, so duplicate values collapse to one row in the result.
Source table data Rows loaded before the example query runs.
Setup
CREATE TABLE orders (id INT, status VARCHAR(20));
INSERT INTO
orders (id, status)
VALUES
(1, 'new'),
(2, 'shipped'),
(3, 'new');Validated query Shared across supported engines.
SQL
SELECT DISTINCT
status
FROM
orders
ORDER BY
status;Expected result Returned rows for the shared example.
| status |
|---|
| new |
| shipped |
The result shape is identical because the query orders the deduplicated values explicitly.