Find nth Highest Salaries in SQL
Maximum Salary, Minimum Salary
and 2nd Highest Salary........
1st Step:-
//create table "employee"
CREATE TABLE employee
(
id int,
name char(20),
dept char(10),
age int,
salary int,
location char(10)
)
then execute table "employee"
SELECT * FROM employee
2nd Step:-
then insert values in 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')
then execute table "employee"
SELECT * FROM employee
Maximum Salary-
Maximum salary in table "employee"
Select MAX(salary) from employee
Minimum Salary-
Minimum salary in table "employee"
Select MIN(salary) from employee
No comments:
Post a Comment