|
Download tasks/readable/014/task_readable.md from megagonlabs/arcs: direct link, hf CLI and curl.
- Browser
- Download file 2.8 kB
-
https://huggingface.co/datasets/megagonlabs/arcs/resolve/main/tasks/readable/014/task_readable.md
- Command line
-
hf download hf://datasets/megagonlabs/arcs/tasks/readable/014/task_readable.md
-
curl -L -o task_readable.md https://huggingface.co/datasets/megagonlabs/arcs/resolve/main/tasks/readable/014/task_readable.md
2.8 kB
Task: 014
Database: retails
Question
Show the supplier that supplies the most parts in their inventory in each region.
Gold Query
WITH supplier_part_count AS (
SELECT r.r_regionkey AS region_key,
r.r_name AS region_name,
s.s_suppkey,
s.s_name,
COUNT(DISTINCT ps.ps_partkey) AS total_quantity,
RANK() OVER (PARTITION BY r.r_regionkey ORDER BY COUNT(DISTINCT ps.ps_partkey) DESC) AS rn
FROM supplier s
JOIN nation n ON s.s_nationkey = n.n_nationkey
JOIN region r ON n.n_regionkey = r.r_regionkey
JOIN partsupp ps ON s.s_suppkey = ps.ps_suppkey
GROUP BY r.r_regionkey, r.r_name, s.s_suppkey, s.s_name
)
SELECT region_key, region_name, s_suppkey, s_name, total_quantity
FROM supplier_part_count
WHERE rn = 1;
Execution Result:
| region_key | region_name | s_suppkey | s_name | total_quantity |
|---|---|---|---|---|
| 0 | AFRICA | 2 | Supplier#000000002 | 80 |
| 0 | AFRICA | 7 | Supplier#000000007 | 80 |
| 0 | AFRICA | 8 | Supplier#000000008 | 80 |
| 0 | AFRICA | 21 | Supplier#000000021 | 80 |
| 0 | AFRICA | 22 | Supplier#000000022 | 80 |
| 0 | AFRICA | 23 | Supplier#000000023 | 80 |
| 0 | AFRICA | 30 | Supplier#000000030 | 80 |
| 0 | AFRICA | 37 | Supplier#000000037 | 80 |
| 0 | AFRICA | 39 | Supplier#000000039 | 80 |
| 0 | AFRICA | 41 | Supplier#000000041 | 80 |
| ... | ... | ... | ... | ... |
| 4 | MIDDLE EAST | 9965 | Supplier#000009965 | 80 |
| 4 | MIDDLE EAST | 9966 | Supplier#000009966 | 80 |
| 4 | MIDDLE EAST | 9967 | Supplier#000009967 | 80 |
| 4 | MIDDLE EAST | 9969 | Supplier#000009969 | 80 |
| 4 | MIDDLE EAST | 9985 | Supplier#000009985 | 80 |
| 4 | MIDDLE EAST | 9989 | Supplier#000009989 | 80 |
| 4 | MIDDLE EAST | 9991 | Supplier#000009991 | 80 |
| 4 | MIDDLE EAST | 9992 | Supplier#000009992 | 80 |
| 4 | MIDDLE EAST | 9994 | Supplier#000009994 | 80 |
| 4 | MIDDLE EAST | 9996 | Supplier#000009996 | 80 |
... truncated (10000 rows total)