|
Download tasks/readable/006/task_readable.md from megagonlabs/arcs: direct link, hf CLI and curl.
- Browser
- Download file 1.04 kB
-
https://huggingface.co/datasets/megagonlabs/arcs/resolve/main/tasks/readable/006/task_readable.md
- Command line
-
hf download hf://datasets/megagonlabs/arcs/tasks/readable/006/task_readable.md
-
curl -L -o task_readable.md https://huggingface.co/datasets/megagonlabs/arcs/resolve/main/tasks/readable/006/task_readable.md
1.04 kB
| # Task: 006 | |
| **Database:** retails | |
| ## Question | |
| Count number of suppliers with negative balance or located in Africa and do not supply Brand#32. | |
| ## Gold Query | |
| ```sql | |
| WITH negative_balance_suppliers AS ( | |
| SELECT s.s_suppkey | |
| FROM supplier s | |
| WHERE s.s_acctbal < 0 | |
| ) | |
| , africa_suppliers AS ( | |
| SELECT DISTINCT s.s_suppkey | |
| FROM supplier s | |
| JOIN nation n ON s.s_nationkey = n.n_nationkey | |
| JOIN region r ON n.n_regionkey = r.r_regionkey | |
| WHERE r.r_name = 'AFRICA' | |
| ) | |
| , brand_32_suppliers AS ( | |
| SELECT DISTINCT s.s_suppkey | |
| FROM supplier s | |
| JOIN partsupp ps ON s.s_suppkey = ps.ps_suppkey | |
| JOIN part p ON ps.ps_partkey = p.p_partkey | |
| WHERE p.p_brand = 'Brand#32' | |
| ) | |
| SELECT COUNT(DISTINCT s.s_suppkey) | |
| FROM supplier s | |
| WHERE ( | |
| s.s_suppkey IN (SELECT s_suppkey FROM negative_balance_suppliers) | |
| OR | |
| s.s_suppkey IN (SELECT s_suppkey FROM africa_suppliers) | |
| ) AND s.s_suppkey NOT IN (SELECT s_suppkey FROM brand_32_suppliers); | |
| ``` | |
| **Execution Result:** | |
| | COUNT(DISTINCT s.s_suppkey) | | |
| |-------------------------------| | |
| | 124 | | |
| *1 rows* |