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 :: install postgresql centos 5 
Sql :: oracle difference between two dates in seconds 
Sql :: execute mysql file 
Sql :: mysql how to store lat,lng 
Sql :: mysql CAST(amount as float) 
Sql :: sql update null values 
Sql :: mysql extract month from date 
Sql :: calculate distance between two latitude longitude points sql 
Sql :: sql date get month 
Sql :: mysql add text to existing field 
Sql :: SHOW COLUMNS Statement 
Sql :: sql how to duplicate a table 
Sql :: ignore case like sql 
Sql :: postgres cast as currency format 
Sql :: postgres set column based on another column 
Sql :: sqlalchemy join on column 
Sql :: postgresql insert column 
Sql :: savepoint in sql 
Sql :: insert current date in mysql 
Sql :: check if database exists sql 
Sql :: drop multiple columns in sql 
Sql :: how to get the date from datetime in mysql 
Sql :: how to insert ip address in mysql using php 
Sql :: mysql alter add foreign key 
Sql :: delete all value query 
Sql :: update table disable constraint 
Sql :: postgres set null 
Sql :: SQL Error 1040 : Too many connections 
Sql :: How to add a Try/Catch to SQL Stored Procedure 
Sql :: output table plsql 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =