Oracle
\nselect stock_name,\n       sum(case when operation = \'Buy\' then  - price\n                else price\n                end) as capital_gain_loss \n  from Sto
```\nselect stock_name,\n       sum(case when operation = \'Buy\' then  - price\n                else price\n                end) as capital_gain_loss \n  from Stocks\ngroup by stock_name\n```
[]