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
Write a SQL queries on Self Join and Inner Join.
What are the default system databases in sql server 2000?
Can you explain full-text query in sql server?
What program is used to store the data source file?
Write a query to include a constraint, to check whether the employee salary is greater than 5000?
How do I perform an unattended install of sql server 2000?
How many levels of sp nesting is possible?
What happens if strings are casted into wrong code pages in ms sql server?
What is a join in sql?
how many layers of tcp/ip protocol combined of? : Sql server database administration
what is the difference in login security modes between v6.5 and 7.0? : Sql server database administration
Mention the differences between having and where clause.
What is 2nf example?
What are the purposes and advantages stored procedure?
Does group by sort data?