diff --git a/Problem1.sql b/Problem1.sql new file mode 100644 index 0000000..26b38b1 --- /dev/null +++ b/Problem1.sql @@ -0,0 +1 @@ +SELECT name, population, area from World where area>= 3000000 or population>=25000000 \ No newline at end of file diff --git a/Problem2.sql b/Problem2.sql new file mode 100644 index 0000000..2f2fc42 --- /dev/null +++ b/Problem2.sql @@ -0,0 +1,12 @@ + +CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT +BEGIN + DECLARE M INT; + SET M=N-1; + RETURN ( + select distinct salary + from employee + order by salary desc + limit M,1 + ); +END diff --git a/Problem3.sql b/Problem3.sql new file mode 100644 index 0000000..9dbb9d9 --- /dev/null +++ b/Problem3.sql @@ -0,0 +1,4 @@ +DELETE p1 from PERSON p1 +JOIN PERSON p2 +ON p1.email = p2.email +AND p1.id>p2.id \ No newline at end of file