-
Problem 1: Big Countries (https://leetcode.com/problems/big-countries/)
--Solution
SELECT name, population, area FROM world WHERE area >= 3000000 OR population >= 25000000;
-
Problem 2: Nth Highest Salary (https://leetcode.com/problems/nth-highest-salary/)
--Solution
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT BEGIN RETURN ( # Write your MySQL query statement below. SELECT DISTINCT IFNULL(salary,null) FROM (SELECT salary, DENSE_RANK() OVER(ORDER BY salary DESC) AS rnk FROM employee ) a WHERE rnk = N ); END
-
Problem 3: Delete Duplicate Emails (https://leetcode.com/problems/delete-duplicate-emails/)
--Solution
DELETE FROM person WHERE id NOT IN
(SELECT DISTINCT id FROM (SELECT id, email, ROW_NUMBER() OVER(PARTITION BY email ORDER BY id) rwn FROM person) a WHERE rwn = 1 );
forked from super30admin/Sql1
-
Notifications
You must be signed in to change notification settings - Fork 0
Feminto/Sql1
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published