An employee table, with the columns id, name, sal and dob.
Query to select emp names of all highest salaries(there are
4-5 people having the same salary which happens to be the
highest).









Answers were Sorted based on User's Feedback



An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / amol dhane

Select * From (Select emp1.*, dense_rank () Over (Order By
sal asc) Salary_Order From employee emp1)emp2 Where
Salary_Order = 1

Is This Answer Correct ?    10 Yes 1 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / kishore kumar

Select ename from emp where sal=(select max(sal) from emp)

Is This Answer Correct ?    13 Yes 5 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / jayabharathi

Select empname,salary from emp where salary=(select
max(salary) from emp)

Is This Answer Correct ?    6 Yes 0 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / reshu singhal

select name from employee where sal = (select max(sal) from
employee)

Is This Answer Correct ?    4 Yes 1 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / subrata sinha roy

SELECT NAME ,SAL FROM employee WHERE
SAL=(SELECT MAX(sal)from employee )

Is This Answer Correct ?    4 Yes 2 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / anil

select name,sal from employee where sal in(select top 5 sal from employee order by sal desc)

Is This Answer Correct ?    7 Yes 7 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / raju

SELECT NAME ,SAL FROM employee WHERE
SAL=(SELECT MAX(sal)from employee )

Is This Answer Correct ?    0 Yes 0 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / swathi

I have just mentioned that 4-5....but ingeneral when you
donno how many employees are there with highly paid
amount...then how are you going to write the query

Is This Answer Correct ?    0 Yes 2 No

An employee table, with the columns id, name, sal and dob. Query to select emp names of all highest..

Answer / kalyan

select name,max(sal) from emp group by name

Is This Answer Correct ?    6 Yes 8 No

Post New Answer

More SQL Server Interview Questions

What are points to remember while using the fillfactor argument?

0 Answers  


what are different types of backups available in sql server? : Sql server database administration

0 Answers  


What is the difference between having and where clause?

4 Answers  


What do you understand by recursive stored procedures?

0 Answers  


How to swap the data of two columns in a table. both the columns containing varchar values.

9 Answers  






How can I create a new template for import ? : sql server management studio

0 Answers  


Which tcp/ip port does sql server run on? How can it be changed?

0 Answers  


How to test values returned by a subquery with the in operator?

0 Answers  


What is sqlcmd?

0 Answers  


How to modify existing triggers using "alter trigger"?

0 Answers  


What is difference between stored procedure and user defined function?

0 Answers  


can any one please send sql quries most used in applications.

2 Answers  


Categories