Let's say I have a SQLite database with a "Food" table and it's got 3 columns.
Name | Food Group | Healthy
Now let's say Healthy is a boolean, which in SQLite is represented by an INTEGER, meaning that this database returns a 1 for healthy foods and a 0 for unhealthy foods.
Now let's say I wanted to write a query that would return all three rows, but instead of a 1 or 0 for healthy, I wanted it to return "Eat me" for healthy foods, and "Avoid me" for unhealthy foods. How could I write a query that would return this using only a SELECT statement?
You can use CASE expression here like:
select Name, case Healthy when 1 then "Eat me" else "Avoid me" end from Food;