Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .sqlfluff
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[sqlfluff]
dialect = postgres
exclude_rules = LT01, LT05, CP02
exclude_rules = LT01, LT05, CP02, CV04

[sqlfluff:rules]
keywords_capitalisation_policy = upper
max_line_length = 120
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Have a good contributing!
- [183. Customers Who Never Order](./leetcode/easy/183.%20Customers%20Who%20Never%20Order.sql)
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
- [577. Employee Bonus](./leetcode/easy/577.%20Employee%20Bonus.sql)
- [586. Customer Placing the Largest Number of Orders](./leetcode/easy/586.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders.sql)
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
2. [Medium](./leetcode/medium/)
- [176. Second Highest Salary](./leetcode/medium/176.%20Second%20Highest%20Salary.sql)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Question 586. Customer Placing the Largest Number of Orders
Link: https://leetcode.com/problems/customer-placing-the-largest-number-of-orders/description/

Table: Orders

+-----------------+----------+
| Column Name | Type |
+-----------------+----------+
| order_number | int |
| customer_number | int |
+-----------------+----------+
order_number is the primary key (column with unique values) for this table.
This table contains information about the order ID and the customer ID.


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(1) DESC
LIMIT 1