I am doing SQL Intermediate course. I am currently on Code Challenge 6
I do understand the conditions in this code, I don’t understand how it works. When I was learning Python, I just read from top to bottom. I cannot do that here. I get the concept but lack true understanding of how it works.
What is the order of operations? What does SQL do first, second, third, etc?
Does this loop work the same as for loop in Python? Does it go first with January through the whole code, then February, etc?
I hope my question is clear.
SELECT premium_users.user_id, months.months, CASE WHEN ( premium_users.purchase_date <= months.months ) AND ( premium_users.cancel_date >= months.months OR premium_users.cancel_date IS NULL ) THEN 'active' ELSE 'not_active' END AS 'status' FROM premium_users CROSS JOIN months;