> For the complete documentation index, see [llms.txt](https://jaywin.gitbook.io/leetcode/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jaywin.gitbook.io/leetcode/solutions/0586-customer-placing-the-largest-number-of-orders.md).

# 0586. Customer Placing the Largest Number of Orders

<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 for this table.
This table contains information about the order ID and the customer ID.
```

Write an SQL query to find the `customer_number` for the customer who has placed **the largest number of orders**.

It is **guaranteed** that exactly one customer will have placed more orders than any other customer.

The query result format is in the following example:

```
Orders table:
+--------------+-----------------+
| order\_number | customer\_number |
+--------------+-----------------+
| 1            | 1               |
| 2            | 2               |
| 3            | 3               |
| 4            | 3               |
+--------------+-----------------+
Result table:
+-----------------+
| customer\_number |
+-----------------+
| 3               |
+-----------------+
The customer with number 3 has two orders, which is greater than either customer 1 or 2 because each of them only has one order. 
So the result is customer\_number 3.
```

**Follow up:** What if more than one customer have the largest number of orders, can you find all the `customer_number` in this case?

## ac

```java
```
