MySQL Easy Implementation
\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
```\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```
['MySQL']