Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Problem1_Big Countries.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
select name,population,area
from world
where area >= 3000000
or population >= 25000000
10 changes: 10 additions & 0 deletions Problem2_NthHighestSalary.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
RETURN (
with cte as(
select id,salary,dense_rank() over (order by salary desc) as salaryrank from employee
)
select distinct ifnull(salary,null) as getNthHighestSalary
from cte where salaryrank=N
);
END
3 changes: 3 additions & 0 deletions Problem3_DeleteDuplicateEmails.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
delete p1
from person p1 cross join person p2
where p1.email=p2.email and p1.id>p2.id