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
10 changes: 10 additions & 0 deletions Nth-Highest-Salary.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
RETURN (
# Write your MySQL query statement below.
WITH CTE AS (
SELECT *,DENSE_RANK() OVER(ORDER BY Salary DESC) AS rnk FROM employee
)
SELECT DISTINCT IFNULL(salary,NULL) FROM CTE WHERE rnk=N
);
END
2 changes: 2 additions & 0 deletions bigcountries.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Write your MySQL query statement below
select name,population, area from world where area>=3000000 or population>=25000000;
2 changes: 2 additions & 0 deletions delete-duplicate-emails.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Write your MySQL query statement below
DELETE FROM PERSON WHERE ID NOT IN (SELECT * FROM (SELECT MIN(ID) FROM PERSON GROUP BY EMAIL) AS EMAIL);