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...

write the query for find the top 2 highest salary in sql
server

Answer Posted / raja.p

Find The 4 Top Salary in a Company
----------------------------------

CREATE TABLE EMPLOYEE2 (NAME VARCHAR2(20), SALARY NUMBER) ;

CREATE TABLE employee2 (
name char(20),
salary float);
INSERT INTO employee2 VALUES (
'Raja',
10000);
INSERT INTO employee2 VALUES (
'Arithas',
10000);
INSERT INTO employee2 VALUES (
'Balaji',
12000);
INSERT INTO employee2 VALUES (
'Vairam',
13000);
INSERT INTO employee2 VALUES (
'Muthu Krishnan',
14000);
INSERT INTO employee2 VALUES (
'Muthu Kumar',
15000);
INSERT INTO employee2 VALUES (
'Ramesh',
9000);

select e.name,e.salary from Employee2 e where 4>(select
count(Distinct
d.salary)from employee2 d where d.salary>e.salary) order by
e.salary desc;

Is This Answer Correct ?    16 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is scd (slowly changing dimension)? : sql server analysis services, ssas

1047


What is 2nf in normalization?

1051


How fixed length strings are truncated and padded?

1018


Introduction of rollup clause using sum and group by clause?

1009


What is de-normalization and what are some of the examples of it?

1016


What are the different sql server versions?

1030


What are the 10 characteristics of data quality?

999


Why use stored procedures in sql server?

1057


Explain the flow of creating a cube? : sql server analysis services, ssas

1097


what is the difference between them (ethernet networks and token ring networks)? : Sql server database administration

1098


What is truncate table?

996


What is cursor in ms sql server?

1199


When would you prefer to have a minimum number of indexes?

959


What is 'Join' and explain its various types.

1209


What happens if the update subquery returns no rows in ms sql server?

1172