FunctionRacerProblemsRace

Revenue per City

MediumSQLSQLite

An order is for qty units of one product. Return each city that has at least one order, with revenue: the sum over its customers' orders of qty times the product's price. Rows may come in any order.

Example 1

customers
idnamecity
1AdaAustin
2BenBoston
3CyAustin
4DeeDenver
orders
idcustomer_idproduct_idqty
11102
23111
32105
products
idnameprice
10pen1.5
11ink8.0
returns
cityrevenue
Austin11.0
Boston7.5

Constraints

Race itor take your time

Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.

More SQL problems