Skip to content

Instantly share code, notes, and snippets.

View ajinkyasirsikar's full-sized avatar

Ajinkya Sirsikar ajinkyasirsikar

View GitHub Profile
@ajinkyasirsikar
ajinkyasirsikar / leetcode_sql.md
Created October 12, 2020 06:09 — forked from JenZhao/leetcode_sql.md
leetcode_sql

Here are my solutions to all SQL problems on leetcode.

Rank

-- how to do rank with out window function
select t1.category, count(distinct t2.id) as dense_rank
from table t1, table t2
where t1.id = t2.id and t1.value <= t2.value 
group by t1.category