How to check dates?

Good day, I have a question:
there is a table:
id | name | start_date | end_date
1 | act1| 2018-02-15 00:00:00 | 2018-04-05 00:00:00
1 | act2 | NULL | 2018-04-23 00:00:00
1 | act3| 2018-02-12 00:00:00 | 2018-02-28 00:00:00
1 | act4| 2018-03-11 00:00:00 | 2018-04-05 00:00:00
1 | act5| 2018-02-15 00:00:00 | 2018-02-20 00:00:00


this table of events
how to draw conclusions from it if start_date is blank or has already arrived at the same end_date has not come, it is Active Actionif the start_date has not come this Upcoming Action, if the end_date has passed this Ended Action

was looking for something in Google but such solutions are not found!
Thanks in advance for the answer!
June 7th 19 at 14:41
2 answers
June 7th 19 at 14:43
Solution
SELECT 'Active Action' as `type`, * FROM `table` WHERE `start_date` IS NULL OR (NOW() BETWEEN `start_date` AND `end_date`)
UNION
SELECT 'Upcoming Action' as `type`, * FROM `table` WHERE `start_date` > NOW();

Something like this...

upd: I haven't checked, perhaps somewhere there is an error, but the point is transferred.
June 7th 19 at 14:45
Try to use if or case statement, for example:
SELECT CASE <variable> WHEN <value> THEN <returnvalue>
 WHEN <othervalue> THEN <returnthis>
 ELSE <returndefaultcase>
 END AS <newcolumnname>
FROM <table></table></newcolumnname></returndefaultcase></returnthis></othervalue></returnvalue></value></variable>

Find more questions by tags MySQLSQL