题目链接:点击打开链接
题目大意:略。
解题思路:略。
AC 代码
WITH t AS(SELECT 'Low Salary' category UNION ALL SELECT 'Average Salary' UNION ALL SELECT 'High Salary'), tt AS(SELECT CASE WHEN income < 20000 THEN 'Low Salary' WHEN income > 50000 THEN 'High Salary' ELSE 'Average Salary' END category FROM Accounts) SELECT t.category, COUNT(tt.category) accounts_count FROM t LEFT JOIN tt USING(category) GROUP BY t.category