Skip to content

nurdamiron/leetcode_database

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 

Repository files navigation

leetcode_database

All my leetcode problem solves

1393. Capital Gain/Loss

image image

Solution

select stock_name, total_sell - total_buy as capital_gain_loss from ( select stock_name, sum(case when operation = 'Sell' then price else 0 end) as total_sell, sum(case when operation = 'Buy' then price else 0 end) as total_buy from stocks group by stock_name) x order by capital_gain_loss

About

All my leetcode problem solves

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published