diff --git a/BigCountries.sql b/BigCountries.sql new file mode 100644 index 0000000..c3baf38 --- /dev/null +++ b/BigCountries.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/DeleteDuplicateEmail.sql b/DeleteDuplicateEmail.sql new file mode 100644 index 0000000..b08f066 --- /dev/null +++ b/DeleteDuplicateEmail.sql @@ -0,0 +1,3 @@ + +DELETE P1 FROM PERSON P1 +CROSS JOIN PERSON P2 WHERE P1.EMAIL = P2.EMAIL and P1.ID >P2.ID diff --git a/NthHighestSalary.sql b/NthHighestSalary.sql new file mode 100644 index 0000000..ad476f3 --- /dev/null +++ b/NthHighestSalary.sql @@ -0,0 +1,9 @@ +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 \ No newline at end of file