Map column data to a value (Oracle)

dictionary, oracle, sql

Solution

You should use a `CASE` statement:

SELECT CASE
  WHEN MILEAGE > 1000 THEN 'High'
  ELSE 'Low'
  END
FROM CAR

Problem

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: - 100 - 500 - 1000 - etc. However, I would like that values above 1000 are labeled as `High` and the rest as `Low`, like this: - Low - Low - High - Low How do I need to change my initial query to do this?

Original source