문제
Write a solution to find the customer_number for the customer who has placed the largest number of orders.
The test cases are generated so that exactly one customer will have placed more orders than any other customer.
문제 풀이
SELECT customer_number
FROM Orders
GROUP BY customer_number
ORDER BY COUNT(*) DESC
LIMIT 1
오답 이유
1. Having으로 풀려고 했음.
2. Order By 뒤에는 변수명만 들어간다고 착각함.
3. DESC, LIMIT 1 하는 거 까먹음.
'취준 > 코팅 테스트' 카테고리의 다른 글
[LeetCode] - 180. Consecutive Numbers (0) | 2024.03.27 |
---|---|
[LeetCode] - 1527. Patients With a Condition (0) | 2024.03.26 |
[LeetCode] - 577.Employee Bonus (0) | 2024.03.18 |
[LeetCode] - 176.Second Higest Salary (0) | 2024.03.13 |
[LeetCode] 1407. Top Travellers (0) | 2024.03.12 |