12 2018 档案
摘要:SELECT e.name,b.bonusFROM Employee eLEFT JOIN Bonus bON e.empId = b.empIdWHERE IFNULL(b.bonus,0)<1000;
阅读全文
摘要: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;
阅读全文
摘要:SELECT NameFROM Employee e1 JOIN (SELECT ManagerId FROM Employee GROUP BY ManagerId HAVING COUNT(ManagerId) >= 5) e2 ON e1.Id = e2.ManagerId;
阅读全文
摘要: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.
阅读全文
摘要:# Write your MySQL query statement belowSELECT w1.IdFROM Weather w1INNER JOIN Weather w2ON TO_DAYS(w1.RecordDate)=TO_DAYS(w2.RecordDate)+1WHERE w1.Tem
阅读全文
摘要:# Write your MySQL query statement belowDELETE p2 FROM Person p1 JOIN Person p2 ON p2.Email = p1.Email WHERE p2.Id > p1.Id;
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:# Write your MySQL query statement belowSELECT d.pay_month,department_id,IF(department_avg=company_avg,'same',IF(department_avg>company_avg,'higher','
阅读全文
摘要:# Write your MySQL query statement belowSELECT MAX(t.num) AS numFROM (SELECT num FROM number GROUP BY num HAVING COUNT(num) = 1) t;
阅读全文
摘要:# Write your MySQL query statement belowSELECT DISTINCT f2.follower,f1.numFROM (SELECT followee, IFNULL(COUNT(DISTINCT followee,follower),0) AS numFRO
阅读全文
摘要:SELECT c.Name AS CustomersFROM Customers cLEFT JOIN Orders oON c.Id = o.CustomerIdWHERE o.Id IS NULL
阅读全文
摘要:# Write your MySQL query statement belowSELECT (MIN(ABS(p1.x-p2.x))) AS shortestFROM point p1LEFT JOIN point p2ON p1.x != p2.x
阅读全文
摘要:SELECT EmailFROM PersonGROUP BY EmailHAVING COUNT(Email) >1;
阅读全文
摘要:SELECT e.Name AS EmployeeFROM Employee eINNER JOIN Employee mON e.ManagerId = m.Id AND e.Salary > m.Salary;
阅读全文
摘要:SELECT DISTINCT l1.Num AS ConsecutiveNumsFROM Logs l1,Logs l2,Logs l3WHERE l1.Id = l2.Id-1 AND l1.Id = l3.Id-2AND l1.Num =l2.Num AND l1.Num=l3.Num;
阅读全文
摘要:# Write your MySQL query statement belowSELECT ROUND(MIN(SQRT(POW(p1.x-p2.x,2)+POW(p1.y-p2.y,2))),2) AS shortestFROM point_2d p1LEFT JOIN point_2d p2O
阅读全文
摘要:SELECT s1.Score, (SELECT COUNT(DISTINCT s.Score) FROM Scores s WHERE s.Score >= s1.Score) AS RankFROM Scores s1ORDER BY s1.Score DESC;
阅读全文
摘要:CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INTBEGIN DECLARE temp int; SET temp = N-1; RETURN ( # Write your MySQL query statement below. SELEC
阅读全文
摘要:select max(Salary) as SecondHighestSalaryfrom Employeewhere Salary < (select max(Salary) from Employee);
阅读全文
摘要:# Write your MySQL query statement belowSELECT *,(IF(x+y>z AND x+z>y AND y+z>x AND ABS(x-y)<z AND ABS(x-z)<y AND ABS(y-z)<x,'Yes','No')) AS triangleFR
阅读全文
摘要:select FirstName, LastName,City, State from Personleft join Address on Person.PersonId = Address.PersonId;
阅读全文