Skip to content

Commit 76dacc6

Browse files
committed
task: #586 & fix linter
1 parent 720c39a commit 76dacc6

File tree

3 files changed

+28
-2
lines changed

3 files changed

+28
-2
lines changed

.sqlfluff

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
[sqlfluff]
22
dialect = postgres
3-
exclude_rules = LT01, LT05, CP02
3+
exclude_rules = LT01, LT05, CP02, CV04
44

55
[sqlfluff:rules]
66
keywords_capitalisation_policy = upper
7-
max_line_length = 120

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Have a good contributing!
3939
- [183. Customers Who Never Order](./leetcode/easy/183.%20Customers%20Who%20Never%20Order.sql)
4040
- [511. Game Play Analysis 1](./leetcode/easy/511.%20Game%20Play%20Analysis%201.sql)
4141
- [577. Employee Bonus](./leetcode/easy/577.%20Employee%20Bonus.sql)
42+
- [586. Customer Placing the Largest Number of Orders](./leetcode/easy/586.%20Customer%20Placing%20the%20Largest%20Number%20of%20Orders.sql)
4243
- [595. Big Countries](./leetcode/easy/595.%20Big%20Countries.sql)
4344
2. [Medium](./leetcode/medium/)
4445
- [176. Second Highest Salary](./leetcode/medium/176.%20Second%20Highest%20Salary.sql)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
Question 586. Customer Placing the Largest Number of Orders
3+
Link: https://leetcode.com/problems/customer-placing-the-largest-number-of-orders/description/
4+
5+
Table: Orders
6+
7+
+-----------------+----------+
8+
| Column Name | Type |
9+
+-----------------+----------+
10+
| order_number | int |
11+
| customer_number | int |
12+
+-----------------+----------+
13+
order_number is the primary key (column with unique values) for this table.
14+
This table contains information about the order ID and the customer ID.
15+
16+
17+
Write a solution to find the customer_number for the customer who has placed the largest number of orders.
18+
19+
The test cases are generated so that exactly one customer will have placed more orders than any other customer.
20+
*/
21+
22+
SELECT customer_number
23+
FROM Orders
24+
GROUP BY customer_number
25+
ORDER BY COUNT(1) DESC
26+
LIMIT 1

0 commit comments

Comments
 (0)