https://leetcode.com/problems/nth-highest-salary/

ATTENTION:limit 子句只能接受int常量,不能接受运算式

CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
SET N = N - 1;
RETURN (
# Write your MySQL query statement below.
select DISTINCT Salary from Employee Order by Salary DESC limit N,1
);
END

  

LeetCode 177 Nth-Highest Salary mysql,取第n条数据,limit子句 难度:1的更多相关文章

  1. LeetCode 177. Nth Highest Salary

    https://leetcode.com/problems/nth-highest-salary/description/ Write a SQL query to get the nth highe ...

  2. 【SQL】177. Nth Highest Salary

    Write a SQL query to get the nth highest salary from the Employee table. +----+--------+ | Id | Sala ...

  3. LeetCode 176 Second Highest Salary mysql,select 嵌套 难度:1

    https://leetcode.com/problems/second-highest-salary/ Write a SQL query to get the second highest sal ...

  4. leetcode - database - 177. Nth Highest Salary (Oracle)

    题目链接:https://leetcode.com/problems/nth-highest-salary/description/ 题意:查询出表中工资第N高的值 思路: 1.先按照工资从高到低排序 ...

  5. 177. Nth Highest Salary

    问题描述 解决方案 CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT BEGIN declare number int; set numbe ...

  6. mysql取前几行数据limit用法

    转自http://www.cnblogs.com/study100/archive/2013/07/30/3224250.html 在mysql中是没有top关键字的,在mysql中可以用limit来 ...

  7. [LeetCode] Nth Highest Salary 第N高薪水

    Write a SQL query to get the nth highest salary from the Employee table. +----+--------+ | Id | Sala ...

  8. leetcode Database3(Nth Highest Salary<—>Consecutive Numbers<—>Department Highest Salary)

    一.Nth Highest Salary Write a SQL query to get the nth highest salary from the Employee table. +----+ ...

  9. LeetCode——Nth Highest Salary

    Write a SQL query to get the nth highest salary from the Employee table. +----+--------+ | Id | Sala ...

随机推荐

  1. 公钥私钥和RSA算法

    1, RSA算法原理(一) http://www.ruanyifeng.com/blog/2013/06/rsa_algorithm_part_one.html 2, RSA算法原理(二) http: ...

  2. my.cnf

    skip-external-locking skip-name-resolve back_log= key_buffer_size=384M max_allowed_packet=4M thread_ ...

  3. SpringMVC和MyBatis整合

    目前主流的Web MVC框架,除了Struts这个主力 外,还有Spring MVC,主要是由于Spring MVC配置比较简单,使用起来也十分明了,非常灵活,与Spring 集成较好,对RESTfu ...

  4. Maven安装与使用

    1.安装Maven 1)官网下载Maven : http://maven.apache.org/download.cgi,解压下载文件 2)配置环境变量 3)验证是否已经安装成功:打开cmd,输入mv ...

  5. Openfire on Centos7

    学习一下linux,装备 1)centos 最小安装.(找抽的节奏) 2)必备 oepnssh yum install openssh-server.x86_64 3)配置网络.打开 /etc/sys ...

  6. [转] - 在mac的终端中使用sublime打开文件

    在mac的终端中使用sublime打开文件 使用sublime提供的命令行工具.这个命令行工具位于 /Applications/Sublime\ Text\ 2.app/Contents/Shared ...

  7. java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver)

    java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver) 1.往项目中添加mysql-conne ...

  8. UIStackView使用 (堆视图)

    一基本使用 1创建多个子控件 for (int i = 0; i < 3; i++) { UIButton *imgBtn = [UIButton buttonWithType:UIButton ...

  9. 腾讯云TCCE培训认证 精彩的第一次

    版权声明:本文由阁主的小跟班  原创文章,转载请注明出处: 文章原文链接:https://www.qcloud.com/community/article/922888001482910380 来源: ...

  10. mybatis中 ${}和#取值小记(Parameter index out of range)

    mybatis mapperxml文件中有两种取值法.${}和#{} $的是原样,#的是取值并转成指定?#{ele1,jdbcType=VARCHAR} 有个坑, 错误的写法 <if test= ...