|
Download tasks/readable/004/task_readable.md from megagonlabs/arcs: direct link, hf CLI and curl.
- Browser
- Download file 2.33 kB
-
https://huggingface.co/datasets/megagonlabs/arcs/resolve/main/tasks/readable/004/task_readable.md
- Command line
-
hf download hf://datasets/megagonlabs/arcs/tasks/readable/004/task_readable.md
-
curl -L -o task_readable.md https://huggingface.co/datasets/megagonlabs/arcs/resolve/main/tasks/readable/004/task_readable.md
2.33 kB
| # Task: 004 | |
| **Database:** retails | |
| ## Question | |
| Find all customers with high account balances and list their number of priority orders. | |
| ## Gold Query | |
| ```sql | |
| WITH high_balance_customers AS ( | |
| SELECT c_custkey, c_name, c_acctbal | |
| FROM customer | |
| WHERE c_acctbal > :account_balance_threshold | |
| ) | |
| SELECT c.c_custkey, | |
| c.c_name, | |
| c.c_acctbal, | |
| COUNT(CASE WHEN o.o_orderpriority IN ('1-URGENT') THEN o.o_orderkey END) AS num_priority_order | |
| FROM high_balance_customers c | |
| LEFT JOIN orders o ON c.c_custkey = o.o_custkey | |
| GROUP BY c.c_custkey, c.c_name | |
| ORDER BY c.c_acctbal DESC; | |
| ``` | |
| **Execution Result:** | |
| | c_custkey | c_name | c_acctbal | num_priority_order | | |
| |-------------|--------------------|-------------|----------------------| | |
| | 14740 | Customer#000014740 | 9999.96 | 2 | | |
| | 118127 | Customer#000118127 | 9999.94 | 3 | | |
| | 48616 | Customer#000048616 | 9999.84 | 3 | | |
| | 75730 | Customer#000075730 | 9999.8 | 2 | | |
| | 73836 | Customer#000073836 | 9999.75 | 0 | | |
| | 72823 | Customer#000072823 | 9999.65 | 5 | | |
| | 122154 | Customer#000122154 | 9999.6 | 0 | | |
| | 330 | Customer#000000330 | 9999.59 | 0 | | |
| | 97961 | Customer#000097961 | 9999.56 | 2 | | |
| | 7986 | Customer#000007986 | 9999.53 | 0 | | |
| | ... | ... | ... | ... | | |
| | 37004 | Customer#000037004 | 9990.8 | 4 | | |
| | 119550 | Customer#000119550 | 9990.75 | 0 | | |
| | 64857 | Customer#000064857 | 9990.71 | 0 | | |
| | 88466 | Customer#000088466 | 9990.57 | 2 | | |
| | 48997 | Customer#000048997 | 9990.54 | 5 | | |
| | 70545 | Customer#000070545 | 9990.36 | 0 | | |
| | 58141 | Customer#000058141 | 9990.3 | 3 | | |
| | 104991 | Customer#000104991 | 9990.27 | 0 | | |
| | 43643 | Customer#000043643 | 9990.11 | 1 | | |
| | 101724 | Customer#000101724 | 9990.08 | 0 | | |
| *... truncated (155 rows total)* |