摘要: SELECT e.name,b.bonusFROM Employee eLEFT JOIN Bonus bON e.empId = b.empIdWHERE IFNULL(b.bonus,0)<1000; 阅读全文
posted @ 2018-12-23 02:48 yuesi 阅读(133) 评论(0) 推荐(0) 编辑
摘要: SELECT NameFROM Candidate c INNER JOIN (SELECT CandidateId FROM Vote GROUP BY CandidateId ORDER BY COUNT(*) DESC LIMIT 1) AS wON c.id = w.CandidateId; 阅读全文
posted @ 2018-12-23 02:44 yuesi 阅读(112) 评论(0) 推荐(0) 编辑
摘要: SELECT NameFROM Employee e1 JOIN (SELECT ManagerId FROM Employee GROUP BY ManagerId HAVING COUNT(ManagerId) >= 5) e2 ON e1.Id = e2.ManagerId; 阅读全文
posted @ 2018-12-23 02:41 yuesi 阅读(77) 评论(0) 推荐(0) 编辑
摘要: Method 1:SELECT t.Request_at AS Day,ROUND(SUM(IF(t.Status = 'completed',0,1)) / COUNT(*) ,2) AS 'Cancellation Rate'FROM Trips tINNER JOIN Users uON t. 阅读全文
posted @ 2018-12-23 02:39 yuesi 阅读(109) 评论(0) 推荐(0) 编辑
摘要: # Write your MySQL query statement belowSELECT w1.IdFROM Weather w1INNER JOIN Weather w2ON TO_DAYS(w1.RecordDate)=TO_DAYS(w2.RecordDate)+1WHERE w1.Tem 阅读全文
posted @ 2018-12-22 03:50 yuesi 阅读(85) 评论(0) 推荐(0) 编辑
摘要: # Write your MySQL query statement belowDELETE p2 FROM Person p1 JOIN Person p2 ON p2.Email = p1.Email WHERE p2.Id > p1.Id; 阅读全文
posted @ 2018-12-22 03:49 yuesi 阅读(126) 评论(0) 推荐(0) 编辑
摘要: SELECT d.Name AS Department,e.Name AS Employee,e.Salary AS SalaryFROM Department d,Employee e, (SELECT MAX(Salary) AS Salary,DepartmentId FROM Employe 阅读全文
posted @ 2018-12-22 03:48 yuesi 阅读(98) 评论(0) 推荐(0) 编辑
摘要: SELECT d.Name AS Department,e.Name AS Employee,e.Salary AS SalaryFROM Employee e,Department dWHERE 3>(SELECT COUNT(DISTINCT e1.Salary) FROM Employee e 阅读全文
posted @ 2018-12-22 03:48 yuesi 阅读(96) 评论(0) 推荐(0) 编辑
摘要: # Write your MySQL query statement belowSELECT d.pay_month,department_id,IF(department_avg=company_avg,'same',IF(department_avg>company_avg,'higher',' 阅读全文
posted @ 2018-12-22 03:47 yuesi 阅读(326) 评论(0) 推荐(0) 编辑
摘要: # Write your MySQL query statement belowSELECT MAX(t.num) AS numFROM (SELECT num FROM number GROUP BY num HAVING COUNT(num) = 1) t; 阅读全文
posted @ 2018-12-20 03:53 yuesi 阅读(86) 评论(0) 推荐(0) 编辑