Search
 
SCRIPT & CODE EXAMPLE
 

SQL

Find second highest salary in MySQL?

SELECT MAX(salary) From emp_table WHERE salary < ( SELECT Max(salary) FROM emp_table);
Comment

2nd highest salary in mysql

#2nd Most highest salary using Limit & Order By
SELECT Salary FROM (SELECT Salary FROM Employee ORDER BY salary DESC LIMIT 2) AS Emp ORDER BY salary LIMIT 1;
Comment

Find second highest salary in MySQL?

SELECT salary FROM (SELECT salary FROM emp_table ORDER BY salary DESC LIMIT 2) AS emp ORDER BY salary LIMIT 1;
Comment

Find second highest most common way salary in MySQL?

SELECT sal FROM emp_table GROUP BY sal ORDER BY sal DESC LIMIT 1, 1;
Comment

2nd highest salary in mysql

#Corelated Subquery
SELECT Id, Salary
FROM Employee e
WHERE 2=(SELECT COUNT(DISTINCT Salary) FROM Employee p
WHERE e.Salary<=p.Salary)
Comment

how to find 2nd highest salary in mysql

#2nd Most highest salary using dense_rank()
SELECT sal 
FROM (SELECT dense_rank() over(ORDER BY sal DESC) AS R, sal FROM emp) employee 
WHERE R = 2;
Comment

second highest salary in mysql

SELECT MAX(salary)   
FROM employees   
WHERE salary NOT IN ( SELECT Max(salary) FROM employees);  
Comment

how to find 2nd highest salary in mysql

#2nd Most highest salary using Group By, Order By & Limit clause
SELECT sal FROM emp GROUP BY sal ORDER BY sal DESC LIMIT 1, 1;
Comment

PREVIOUS NEXT
Code Example
Sql :: drop constraint in ms sql 
Sql :: postgres enumerated type 
Sql :: how to print out column name differently in mysql 
Sql :: sql update subtract value 
Sql :: sql comment 
Sql :: How to automatically export database to a csv file 
Sql :: sql constraints 
Sql :: sql datetime functions 
Sql :: sql server port number 
Sql :: delete join sql server 
Sql :: Selecting from a view SQL 
Sql :: insert sql 
Sql :: online sql compiler 
Sql :: mysql create trigger 
Sql :: mysql update one table from another table multiple columns 
Sql :: mysql login 
Sql :: current month transactions in mysql 
Sql :: install sql server windows 10 
Sql :: cronjob mysql backup 
Sql :: sql server manager close connection 
Sql :: SQL Query Records Using Dates 
Sql :: trigger stock phpmyadmin 
Sql :: create sql table from script inline primary key constraint 
Sql :: db2 foreign keys 
Sql :: how to innjert in other database 
Sql :: qt qsql check if table exist 
Sql :: SELECT multiple from database 
Sql :: forenkey code alchemy sql 
Sql :: oracle generate sequence of numbers 
Sql :: enable mysql remote connection to two specific ip address 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =