# Write your MySQL query statement below
select stock_name,
sum(
case
when operation = 'Buy' then -price
else price
end
) as capital_gain_loss
from Stocks
group by stock_name
#CASE
#WHEN condition1 THEN result1
#WHEN condition2 THEN result2
#WHEN conditionN THEN resultN
#ELSE result
#END;