Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to find the n'th highest salary from emp ?

Answer Posted / ramaniranjan das

select top1 * from (select distinct top nth from table name
by column name ) alisa name of table order by column name

Example:-Create table tab_employee
(
Emp_id int,
Emp_name varchar(50),
Emp_salary money,
Emp_deg varchar(30),
emp_add varchar(100)
);
INSERT INTO tab_employee
VALUES ('1001','ANIL','18000','MANAGER','hyd')
Go
INSERT INTO tab_employee
VALUES ('1002','AKIL','6000','CLERK','Mub')
Go
INSERT INTO tab_employee
VALUES ('1003','VINOD','7000','SALESMAN','Bang' )
GO
INSERT INTO tab_employee
VALUES ('1004','VIKAS','8000','SALESMAN','BBSR' )
GO
INSERT INTO tab_employee
VALUES ('1005','SUNIL','15000','MANAGER','Orissa' )

select top 1 * from tab_employee where Emp_salary not in
(Select Distinct top 3 Emp_salary from tab_employee order
by Emp_salary Desc)order by Emp_salary Desc

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What privilege is needed for a user to delete rows from tables in another schema?

1133


What is the use of aggregate functions in oracle?

1071


How to revoke create session privilege from a user in oracle?

1068


How do I spool to a csv formatted file using sqlplus?

1085


What are the advantages of oracle?

1068


Explain a synonym?

1086


How to add a new column to an existing table in oracle?

1186


For a field in a repeating frame, can the source come from the column which does not exist in the data group which forms the base for the frame ?

2066


What is the difference between hot backup and cold backup in oracle?

1076


How to use attributes of the implicit cursor in oracle?

1061


What are ddl statements in oracle?

1127


How do I manually create a database in oracle?

1068


How to connect to a local oracle 10g xe server?

1032


What is user managed backup in Oracle?

1202


What privilege is needed for a user to query tables in another schema?

1030