MYSQL SIMPLER THAN SIMPLEST FASTER THAN 95%
\nSELECT stock_name, SUM(CASE WHEN operation = "Buy" THEN price * (-1) ELSE price END) AS capital_gain_loss\nFROM Stocks\nGROUP BY stock_name\n\n
```\nSELECT stock_name, SUM(CASE WHEN operation = "Buy" THEN price * (-1) ELSE price END) AS capital_gain_loss\nFROM Stocks\nGROUP BY stock_name\n```\n
[]