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
How to run sql server 2005 books online on your local system?
In which tcp/ip port does sql server run? Can it be changed?
What command must you use to include the not null constraint after a table has already been created?
You have several tables, and they are joined together for querying. The tables contain both clustered indexes and non clustered indexes to optimize performance, how should you distribute the tables and their indexes onto different file groups?
what is create database syntax? : Sql server database administration
let's assume you have data that resides on sql server 6.5. You have to move it sql server 7.0. How are you going to do it? : Sql server database administration
How to get a list of columns using the "sys.columns" view in ms sql server?
What are the properties and different types of sub-queries?
Explain what is the difference between union and union all?
What are the source of constraints?
What is standby servers? Explain types of standby servers.
What is sub query and its properties?
What is function of ROLLUP ?
How is a full-text index updated?
What are the tools available in market as an alternative to sql server reporting services?