arcs / tasks /readable /007 /task_readable.md
yanlinf's picture
Release ARCS dataset
1fb4e2d verified
|
Raw History Blame Contribute Delete
644 Bytes
# Task: 007
**Database:** retails
## Question
Count total number of distinct parts shipped in Q4 1996 and 1997 from orders with high order priority.
## Gold Query
```sql
SELECT COUNT(DISTINCT p.p_partkey) as total_distinct_parts
FROM lineitem l
JOIN part p ON l.l_partkey = p.p_partkey
JOIN orders o ON l.l_orderkey = o.o_orderkey
WHERE o.o_orderpriority IN ('1-URGENT', '2-HIGH')
AND (
(l.l_shipdate >= '1996-10-01' AND l.l_shipdate < '1997-01-01') OR
(l.l_shipdate >= '1997-01-01' AND l.l_shipdate < '1998-01-01')
);
```
**Execution Result:**
| total_distinct_parts |
|------------------------|
| 179839 |
*1 rows*