Mapping values in SQL select?
You can use case
expression:
select
id,
name,
case
when category = 'fruits' then 'Fruit Plant'
when category = 'vegetables' then 'Vegetable Plant'
when category is null then 'unknown'
end as category
from Plant
use case
function (with else statement for default values) :
select id, name,
case category
when 'vegetables' then 'Vegetable Plant'
when 'fruits' then 'Fruit Plant'
when is null then 'unknown'
else 'default values'
end
from Plant