Procurement & Sourcing Analytics · Mission 11 of 30Medium

Top 10 suppliers by spend

GROUP BY + ORDER BY + LIMIT

The Brief

Maya ChenProcurement Directorprocurement-ops

Top 10 suppliers ranked by total invoice spend. Show supplier_name, total_spend descending.

You'll practice

GROUP BYLIMITORDER BY

Tables & columns available

fact_invoicesfact7 columns
ColumnTypeKey
invoice_idINTPK
po_idINTFK → fact_purchase_orders
supplier_idINTFK → dim_suppliers
invoice_dateTEXT
invoice_amountREAL
po_amountREAL
payment_dateTEXT
dim_suppliersdim8 columns
ColumnTypeKey
supplier_idINTPK
supplier_nameTEXT
countryTEXT
tierINT
category_focusTEXT
diversity_certifiedINT
payment_terms_daysINT
is_preferredINT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Spend ranks roll up on the invoice side; bring supplier_name in from the dim, then group + sum + sort + cap.

Hint 2

GROUP BY, SUM(invoice_amount).

Hint 3

ORDER BY DESC, LIMIT 10.