LeetCode sql
Posted Hank
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode sql相关的知识,希望对你有一定的参考价值。
1.【简单】组合两个表
select p.FirstName,p.LastName,a.City,a.State from person p left join address a on p.personid=a.personid;
2.【简单】第二高的薪水
select ifnull((select distinct(Salary) from Employee order by Salary desc limit 1,1),null) as SecondHighestSalary;
3.【中等】第N高的薪水
CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
set n=n-1;
RETURN (
# Write your mysql query statement below.
select distinct Salary as getNthHighestSalary
from Employee
order by Salary DESC
limit N,1
);
END
4.【简单】有趣的电影
以上是关于LeetCode sql的主要内容,如果未能解决你的问题,请参考以下文章
sql 日期转换代码片段 - Dato,120,konvertere
以下代码片段是不是容易受到 Rails 5 中 SQL 注入的影响?
leetcode_1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold_[二维前缀和](代码片段