diff --git a/problem1-595-Big-countries.sql b/problem1-595-Big-countries.sql new file mode 100644 index 0000000..4630923 --- /dev/null +++ b/problem1-595-Big-countries.sql @@ -0,0 +1,2 @@ +Select name,population,area from World +where area >= 3000000 or population >= 25000000 \ No newline at end of file diff --git a/problem2-177-nthhighest-salary.sql b/problem2-177-nthhighest-salary.sql new file mode 100644 index 0000000..4a5b11c --- /dev/null +++ b/problem2-177-nthhighest-salary.sql @@ -0,0 +1,14 @@ +CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT +BEGIN + DECLARE M INT; + SET M = N-1; + RETURN ( + # Write your MySQL query statement below. + select + distinct salary + from + Employee + order by salary desc + LIMIT M,1 + ); +END \ No newline at end of file diff --git a/problem3-196-delete-duplicate-emails.sql b/problem3-196-delete-duplicate-emails.sql new file mode 100644 index 0000000..b4ddeb5 --- /dev/null +++ b/problem3-196-delete-duplicate-emails.sql @@ -0,0 +1,6 @@ +delete p1 +from +person p1 +cross join person p2 +where p1.email = p2.email +and p1.id > p2.id \ No newline at end of file