Categorise the performance of all the videos released by the “Motivation grid” Channel (id = 350).
Performance of a video is measured based on the number of views of the video.
no_of_viewscategory<= 10000 poor
10000 < views <= 100000
and
average> 100000 good
Sort the output in the ascending order of
name , no_of_views , category
SELECT
name,
sum(no_of_views) AS no_of_views,
CASE
WHEN sum(no_of_views) <= 10000 THEN "poor"
WHEN sum(no_of_views) < 10000
AND sum(no_of_views) <= 100000 THEN "average"
ELSE "good"
END AS category
FROM
video
WHERE
channel_id = 350
GROUP BY
name
ORDER BY
published_datetime DESC;
please help
Comments
Leave a comment