Snoopy [리트코드/SQL] 23. Customer Placing the Largest Number of Orders (586)
코딩테스트/리트코드 SQL

[리트코드/SQL] 23. Customer Placing the Largest Number of Orders (586)

Sooyoon Jeong 2022. 12. 18.
 
 

Customer Placing the Largest Number of Orders - LeetCode

Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.

leetcode.com


🤔 문제 분석

1) Write an SQL query to find the for the customer who has placed the largest number of orders.

2) 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

댓글