#318

P&L on Stock Trades

For each stock compute its capital gain or loss: total sales minus total purchases. Return stock_name and capital_gain_loss.

Expected output sample

This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.

stock_namecapital_gain_loss
MSFT30
GOOG20
AAPL40

Your query result will appear here