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

Write a SQL queries on Self Join and Inner Join.

1052


What are the default system databases in sql server 2000?

1034


Can you explain full-text query in sql server?

1019


What program is used to store the data source file?

972


Write a query to include a constraint, to check whether the employee salary is greater than 5000?

1612


How do I perform an unattended install of sql server 2000?

1089


How many levels of sp nesting is possible?

1062


What happens if strings are casted into wrong code pages in ms sql server?

1119


What is a join in sql?

1103


how many layers of tcp/ip protocol combined of? : Sql server database administration

1007


what is the difference in login security modes between v6.5 and 7.0? : Sql server database administration

1142


Mention the differences between having and where clause.

1067


What is 2nf example?

1001


What are the purposes and advantages stored procedure?

962


Does group by sort data?

909