In this exercise I am asked to generate a table of user ids and total watch duration for users who watched more than 400 minutes of content.
My code does exactly the same as the solution but mine refers to the columns with numbers (as I’ve done before) in order to avoid having to type their names again. It’s not a big deal but it’s annoying because I think I’m right. Please tell me where I’m wrong, does the ‘HAVING’ clause not support this maneuver?
(It doesn’t let me select SQL Language when creating a Codebyte so I just left the code here)
SELECT user_id, SUM(watch_duration_in_minutes) FROM watch_history GROUP BY 1 HAVING 2 > 400 ;