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
if you encounter this kind of an error message, what you need to look into to solve this problem? : Sql server database administration
What are the differences between char and varchar in ms sql server?
What is the difference between update lock and exclusive lock?
What is a view in sql?
What is the difference between mysql and sql server?
What are the components of dbms?
What is the difference between sdf and mdf?
Where are sql server usernames and passwords stored in the sql server?
When would you use it?
What do you mean by data integrity?
How do you start single user mode in clustered installations?
What are the different types of collation sensitivity?
What is @@rowcount in sql?
How do I create an extended event in sql server?
How to configure odbc dsn with different port numbers?