Hello, I have a question about using column’s number reference in SQL GROUP BY statement.
For example I have query as follows;
SELECT COUNT(*) AS Appearance,CASE WHEN url LIKE '%github.com%' THEN 'Github' WHEN url LIKE '%medium.com%' THEN 'Medium' WHEN url LIKE '%nytimes%' THEN 'NYtimes' ELSE 'others' END AS 'Source' FROM hacker_news GROUP BY 2;
Question : When using number reference on GROUP BY, does it take into account new column ‘Source’ as well that I created in CASE statement? or only columns in only original data scheme?