Search
 
SCRIPT & CODE EXAMPLE
 

SQL

find nth highest salary of an employee

#Method 1
SELECT salary FROM Employee ORDER BY salary DESC LIMIT N-1, 1

#Method 2
SELECT salary FROM Employee AS e1 
WHERE n-1=(SELECT COUNT(DISTINCT,salary) FROM Employee AS e2 
           WHERE e2.salary>e1.salary)
Comment

PREVIOUS NEXT
Code Example
Sql :: sql today at midnight 
Sql :: mysql reset auto increment id 
Sql :: create row number in sql 
Sql :: sql fill na with 0 
Sql :: spark sql convert string to date 
Sql :: how to find date from date table in sql 
Sql :: postgres format date in select 
Sql :: oracle create program if not exists 
Sql :: postgres alter table add column with default value 
Sql :: mysql set primary key 
Sql :: date to string sql 
Sql :: Syntax of for-loop in SQL Server 
Sql :: list foreign data tables postgres psql 
Sql :: sql server date now 
Sql :: oracle alter tablespace add datafile autoextend max size 
Sql :: insert multiple rows in sql workbench 
Sql :: mysql pretty date format 
Sql :: SQl Server Versionen Releases und Build-Nummern 
Sql :: mysql select column where has non int values 
Sql :: how to change mysql root password in windows 10 
Sql :: ajouter une clé etrangere mysql 
Sql :: insert a select statement into a table 
Sql :: set column to not null mysql 
Sql :: oracle add auto_increment column to existing table 
Sql :: mysql find missing values 
Sql :: set nocount on sql 
Sql :: mysql update row 
Sql :: sql server: difference between hashtable and table declared using declare keyword 
Sql :: how to select first row of database sql 
Sql :: CX_Oracle - import data from Oracle to Pandas dataframe 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =