CASE | SUM
\n# Write your MySQL query statement below\nSELECT stock_name,\nSUM(\n    CASE \n    WHEN operation = \'Buy\' THEN -price \n    WHEN operation = \'Sell\' THEN p
```\n# Write your MySQL query statement below\nSELECT stock_name,\nSUM(\n    CASE \n    WHEN operation = \'Buy\' THEN -price \n    WHEN operation = \'Sell\' THEN price\n    END)\nAS capital_gain_loss\nFROM Stocks\nGROUP BY stock_name\n```
['MySQL']