A stock brokerage platform needs to calculate the net profit or loss for its users. You are given a table containing all buy and sell operations.
Write an SQL query to report the Capital gain/loss for each stock.
| stock_name(VARCHAR) | operation(VARCHAR) | operation_day(INTEGER) | price(INTEGER) |
|---|---|---|---|
| Leetcode | Buy | 1 | 1000 |
| Corona Masks | Buy | 2 | 10 |
| Leetcode | Sell | 5 | 9000 |
| Handbags | Buy | 17 | 30000 |
| Corona Masks | Sell | 3 | 1010 |
| Corona Masks | Buy | 4 | 1000 |
| Corona Masks | Sell | 5 | 500 |
| Corona Masks | Buy | 6 | 1000 |
| Corona Masks | Sell | 10 | 10000 |
| Handbags | Sell | 29 | 7000 |
| Leetcode | Buy | 11 | 100 |
| Leetcode | Sell | 15 | 100 |
| stock_name(VARCHAR) | capital_gain_loss(INTEGER) |
|---|---|
| Corona Masks | 9500 |
| Leetcode | 8000 |
| Handbags | -23000 |