Supplier With the Most Deliveries
Problem
Table: `Delivery`
```text
+--------------+-------------+
| Column | Type |
+--------------+-------------+
| delivery_ref | int |
| supplier_id | int |
+--------------+-------------+
delivery_ref is the primary key. Each row records one delivery made by a supplier.
```
Find the `supplier_id` that made the **largest number of deliveries**. The data is set up so that exactly one supplier has more deliveries than any other.
**Example**
```text
Delivery:
+--------------+-------------+
| delivery_ref | supplier_id |
+--------------+-------------+
| 1 | 11 |
| 2 | 22 |
| 3 | 33 |
| 4 | 33 |
+--------------+-------------+
Output:
+-------------+
| supplier_id |
+-------------+
| 33 |
+-------------+
```
Supplier 33 made two deliveries, more than any other supplier.
Tables
Example rows — the live problem includes the full dataset.
| delivery_ref | supplier_id |
|---|---|
| 1 | 11 |
| 2 | 22 |
| 3 | 33 |
Expected output
Your answer should return 1 row with the columns supplier_id.
Starter code (SQL)
SELECT *
FROM Delivery;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock