Reputation: 4380
I have an Oracle database and I have a table named Car
. I can select the Mileage
of the cars like this:
SELECT MILEAGE FROM CAR
This gives me:
However, I would like that values above 1000 are labeled as High
and the rest as Low
, like this:
How do I need to change my initial query to do this?
Upvotes: 2
Views: 3070
Reputation: 43494
You should use a CASE
statement:
SELECT CASE
WHEN MILEAGE > 1000 THEN 'High'
ELSE 'Low'
END
FROM CAR
Upvotes: 8