SELECT
CASE
WHEN
column IS NULL OR another_column = 1
THEN
'yes'
ELSE
'no'
END AS 'MyData'
FROM
table_name;
select
(CASE
WHEN (market_cap < 300000000) THEN 'micro'
WHEN (market_cap < 2000000000) THEN 'small'
WHEN (market_cap < 10000000000) THEN 'mid'
WHEN (market_cap < 50000000000) THEN 'large'
ELSE 'mega'
END) AS `cap_type`
from companies;
SELECT CASE col1
WHEN 'agree' THEN 'Ok'
WHEN 'disagree' THEN 'Ko'
ELSE
CASE
WHEN col2 >= 1 THEN 'Ko'
ELSE 'Maybe'
END
END AS my_result
FROM table_name;