Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql get nth highest

CREATE FUNCTION getNthHighestSalary(N INT) RETURNS INT
BEGIN
  SET N = N-1;
  
  RETURN (
      # Where Salary is your column name and Employee your table
      SELECT DISTINCT(Salary) FROM Employee ORDER BY Salary DESC LIMIT N, 1
  );
END
Comment

PREVIOUS NEXT
Code Example
Sql :: for json path sql server 
Sql :: show query code after create table in sql 
Sql :: rename table sqlite 
Sql :: sql function to add all values round of 2 decimal places 
Sql :: datetime postgres typeorm 
Sql :: MYSQLI_ASYNC 
Sql :: current date in sql 
Sql :: sql round 2 decimal 
Sql :: Write an SQL query to print details of the Workers who have joined in Feb’2014 
Sql :: AND OR NOT operators sql 
Sql :: how to change column name in mysql 
Sql :: median mysql 
Sql :: sql currency format 
Sql :: postgres update single column 
Sql :: mysql repeated values 
Sql :: c# update sql statement 
Sql :: how to ascending order in sql 
Sql :: postgres dump sql insert 
Sql :: SQL Duplicates by Composite 
Sql :: sql delimiter to columns 
Sql :: snowflake select from stage 
Sql :: nvl in oracle 
Sql :: all tables and views oracle 
Sql :: t-sql random number for each row 
Sql :: mql5 datetime get hour 
Sql :: sql right characters 
Sql :: mysql remove unique key 
Sql :: database stuck on restoring 
Sql :: oracle list days between two dates 
Sql :: smallint sql 
ADD CONTENT
Topic
Content
Source link
Name
4+3 =