From e16f23611abc16d06cf1abb98660348f63fea6fc Mon Sep 17 00:00:00 2001 From: tejas274 Date: Tue, 20 May 2025 16:59:44 -0400 Subject: [PATCH 1/3] sql-1 problem 1 and problem 2 --- problem_1.sql | 2 ++ problem_2.sql | 14 ++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 problem_1.sql create mode 100644 problem_2.sql diff --git a/problem_1.sql b/problem_1.sql new file mode 100644 index 0000000..4630923 --- /dev/null +++ b/problem_1.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/problem_2.sql b/problem_2.sql new file mode 100644 index 0000000..4a5b11c --- /dev/null +++ b/problem_2.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 From 40410690912f6899a8a77c31c523109d54e37141 Mon Sep 17 00:00:00 2001 From: tejas274 Date: Wed, 21 May 2025 08:51:06 -0400 Subject: [PATCH 2/3] feat: problem-3 added --- problem_3.sql | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 problem_3.sql diff --git a/problem_3.sql b/problem_3.sql new file mode 100644 index 0000000..b4ddeb5 --- /dev/null +++ b/problem_3.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 From edfe1c7fe41c36bb8ec5a83553c895a776b677eb Mon Sep 17 00:00:00 2001 From: tejas274 Date: Wed, 21 May 2025 09:31:54 -0400 Subject: [PATCH 3/3] correcting file names for future ref --- problem_1.sql => problem1-595-Big-countries.sql | 0 problem_2.sql => problem2-177-nthhighest-salary.sql | 0 problem_3.sql => problem3-196-delete-duplicate-emails.sql | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename problem_1.sql => problem1-595-Big-countries.sql (100%) rename problem_2.sql => problem2-177-nthhighest-salary.sql (100%) rename problem_3.sql => problem3-196-delete-duplicate-emails.sql (100%) diff --git a/problem_1.sql b/problem1-595-Big-countries.sql similarity index 100% rename from problem_1.sql rename to problem1-595-Big-countries.sql diff --git a/problem_2.sql b/problem2-177-nthhighest-salary.sql similarity index 100% rename from problem_2.sql rename to problem2-177-nthhighest-salary.sql diff --git a/problem_3.sql b/problem3-196-delete-duplicate-emails.sql similarity index 100% rename from problem_3.sql rename to problem3-196-delete-duplicate-emails.sql