Leecode - 2298. Tasks Count in the Weekend

Indo Yoon

Problem

Tasks Count in the Weekend - LeetCode
Tasks Count in the Weekend - Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

Solution

SELECT COUNT(weekend) AS weekend_cnt, COUNT(working) AS working_cnt
FROM (
    SELECT CASE WHEN WEEKDAY(submit_date) > 4 THEN 'weekend' END as weekend,
             CASE WHEN WEEKDAY(submit_date) < 5 THEN 'working' END as working
    FROM Tasks
) AS Temp