FunctionRacerProblemsRace

Bought and Sold

EasySQLSQLite

Return each symbol once with bought, the total qty of its buys, and sold, the total qty of its sells. A symbol with no sells has sold 0, and likewise for buys. Rows may come in any order.

Example 1

trades
idsymbolsideqtyprice
1AAPLbuy10190.5
2AAPLsell4191.0
3MSFTbuy5410.0
4AAPLbuy1189.0
returns
symbolboughtsold
AAPL114
MSFT50

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