correctness 9.0quality 8.0documentation 9.012797ms
# Logic is correct and uses ROW_NUMBER + window function for revenue_pct appropriately, but recomputing country aggregates via a second orders/customers join (instead of deriving from customer_spend) is slightly redundant.
inspect full trace →correctness 5.0quality 7.0documentation 9.04904ms
# Logic for revenue, avg, and top_customer (via DISTINCT ON) is correct, but revenue_pct is computed with a CROSS JOIN CTE rather than an actual window function (SUM(...) OVER()), directly violating an explicit requirement despite the model's rationalization; comments and explanations are clear and well-organized otherwise.
inspect full trace →correctness 8.0quality 6.0documentation 6.016174ms
# patched after judge fix
inspect full trace →correctness 2.0quality 5.0documentation 7.0977ms
# The country_sales CTE groups by (country, name), so downstream MAX() aggregation in country_data yields the top customer's revenue/order_count/avg instead of the country's true totals (correct only when a country has a single customer), and revenue_pct is computed via a CROSS JOIN scalar CTE rather than a window function as required; despite clear comments and a single final SELECT, the core aggregation logic is fundamentally broken.
inspect full trace →