美文网首页
Leetcode Mysql题目

Leetcode Mysql题目

作者: C就要毕业了 | 来源:发表于2017-09-23 19:35 被阅读0次

    175. Combine Two Tables

    https://leetcode.com/problems/combine-two-tables/description/

    SELECT FirstName, LastName, City, State 
    FROM Person AS p
    LEFT JOIN Address as a
    ON p.PersonId = a.PersonId
    

    176. Second Highest Salary

    https://leetcode.com/problems/second-highest-salary/description/

    LIMIT a OFFSET b
    取出第b+1条记录起的a条记录

    SELECT Salary AS SecondHighestSalary
    FROM Employee
    ORDER BY Salary
    LIMIT 1 OFFSET 1
    
    SELECT max(Salary) AS SecondHighestSalary
    FROM Employee
    WHERE Salary < (SELECT max(Salary) FROM Employee)
    

    相关文章

      网友评论

          本文标题:Leetcode Mysql题目

          本文链接:https://www.haomeiwen.com/subject/dkbvjxtx.html