문제
입력 코드
(SELECT "Low Salary" AS category,
(SELECT COUNT(account_id)
FROM Accounts
WHERE income < 20000) AS accounts_count)
UNION ALL
(SELECT "Average Salary" AS category,
(SELECT COUNT(account_id)
FROM Accounts
WHERE income >= 20000 and income <= 50000) AS accounts_count)
UNION ALL
(SELECT "High Salary" AS category,
(SELECT COUNT(account_id)
FROM Accounts
WHERE income > 50000) AS accounts_count)
코드 설명
#SELECT #COUNT #UNION #UNION ALL
문제 출처
'SQL' 카테고리의 다른 글
#112. [LeetCode / MySQL] 626. Exchange Seats (0) | 2024.06.17 |
---|---|
#111. [LeetCode / MySQL] 1978. Employees Whose Manager Left the Company (0) | 2024.06.17 |
#109. [LeetCode / MySQL] 1204. Last Person to Fit in the Bus (0) | 2023.10.05 |
#108. [LeetCode / MySQL] 1164. Product Price at a Given Date (0) | 2023.10.04 |
#107. [LeetCode / MySQL] 180. Consecutive Numbers (0) | 2023.10.03 |