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
What are the different types of triggers in SQL SERVER?
Can you edit the .rdl code associated with a linked report?
Explain for xml explicit mode?
Difference between LEN() and DATALENGTH() in sql server ?
What is the syntax to execute the sys.dm_db_missing_index_details?
Can we add an identity column to decimal datatype?
what are the basic functions for master, msdb, model, tempdb and resource system databases? : sql server database administration
List some advantages and disadvantages of stored procedure?
How ssrs maintain security?
What is data source view or dsv? : sql server analysis services, ssas
What is data source document?
Explain a differential backup?
What is stored in the mssqlsystemresource database? : sql server database administration
How would you go about developing a ssrs report?
Why I am getting "the microsoft .net framework 2.0 in not installed" message?