Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 013103f

Browse files
authoredFeb 26, 2019
Add files via upload
1 parent 87814e8 commit 013103f

File tree

9 files changed

+55
-1
lines changed

9 files changed

+55
-1
lines changed
 

‎Big Countries/Big_Countries.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Runtime: 196 ms, faster than 100.00% of MySQL online submissions for Big Countries.
2+
# Write your MySQL query statement below
3+
SELECT name, population,area
4+
FROM World
5+
WHERE population > 25000000 OR area > 3000000;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Write your MySQL query statement below
2+
# Runtime: 188 ms, faster than 100.00% of MySQL online submissions for Classes More Than 5 Students.
3+
select class from courses group by class having count(distinct student) >= 5;

‎Combine Two Tables/Combine_Two_Tables.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# Write your MySQL query statement below
1+
-- Write your MySQL query statement below
2+
-- Runtime: 276 ms, faster than 6.52% of MySQL online submissions for Combine Two Tables.
23
select t1.FirstName, t1.LastName, t2.City, t2.State
34
from Person t1
45
left outer join Address t2
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Write your MySQL query statement below
2+
# Runtime: 261 ms, faster than 40.78% of MySQL online submissions for Customers Who Never Order.
3+
4+
SELECT Name as Customers
5+
FROM Customers
6+
WHERE id NOT IN
7+
(
8+
SELECT t1.id
9+
FROM Customers t1
10+
INNER JOIN Orders t2
11+
ON t1.Id = t2.CustomerId
12+
);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Write your MySQL query statement below
2+
# Runtime: 544 ms, faster than 92.21% of MySQL online submissions for Delete Duplicate Emails.
3+
delete from Person where Id not in
4+
(
5+
select temp.Id
6+
From
7+
(
8+
select MIN(Id) as Id
9+
FROM Person
10+
GROUP BY Email
11+
)
12+
as temp
13+
);

‎Duplicate Emails/Duplicate_Emails.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Write your MySQL query statement below
2+
# Runtime: 206 ms, faster than 29.08% of MySQL online submissions for Duplicate Emails.
3+
select Email from Person group by Email having count(distinct Id) > 1;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Write your MySQL query statement below
2+
# Runtime: 302 ms, faster than 51.16% of MySQL online submissions for Employees Earning More Than Their Managers.
3+
SELECT t1.Name AS Employee
4+
FROM Employee t1, Employee t2
5+
WHERE t1.ManagerId = t2.Id AND t1.Salary > t2.Salary;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write your MySQL query statement below
2+
# Runtime: 118 ms, faster than 97.65% of MySQL online submissions for Not Boring Movies.
3+
SELECT *
4+
FROM cinema
5+
WHERE id MOD 2 = 1 AND description <> 'boring'
6+
ORDER BY rating DESC;

‎Swap Salary/Swap_Salary.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Write your MySQL query statement below
2+
# Runtime: 142 ms, faster than 100.00% of MySQL online submissions for Swap Salary.
3+
-- 按理说第一条语句就可以,但是没有结果,应该是网站出现了一些bug
4+
# UPDATE salary SET sex = IF (sex = 'm', 'f', 'm')
5+
SELECT id, name, IF (sex = 'm', 'f', 'm') as sex, salary
6+
FROM salary;

0 commit comments

Comments
 (0)