Showing posts with label Find 3rd Highest Salary in Sql. Show all posts
Showing posts with label Find 3rd Highest Salary in Sql. Show all posts

Friday, 9 October 2015

Find 3rd Highest Salary in Sql

Find 3rd Highest Salary in Sql


Step 1:-
Create a table named "Employee" in your database......

CREATE TABLE employee
(
id int,
name char(20),
dept char(10),
age int,
salary int,
location char(10)
)

Step 2:-
Insert some values into the table "Employee"

Insert into employee values(1,'RAM','Soft Eng',24,30000,'Banglore')
Insert into employee values(2,'Shyam','Progmmer',24,40000,'DELHI')
Insert into employee values(3,'Manoj','Admin',24,50000,'MUMBAI')
Insert into employee values(4,'RAja','Progmmer',24,33000,'DELHI')
Insert into employee values(5,'Sunny','Soft Eng',24,32000,'Banglore')
Insert into employee values(6,'Nukul','Soft Eng',24,31000,'MUMBAI')
Insert into employee values(7,'Laxmi','Data Admin',24,36000,'DELHI')
Insert into employee values(8,'RAmesh','Soft Eng',24,80000,'MUMBAI')


Step 3:-
Execute the table "Employee"

SELECT * FROM employee

Step 4:-
3rd Highest  Salary in the table "Employee"

SELECT MIN(salary)
FROM
      (SELECT DISTINCT TOP 3 salary FROM employee ORDER BY salary DESC)
as a




....................................................................

Factorial of a Number

Recently Viewed