Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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 is store procedure? How do they work? When do you use?

0 Answers  


what do you understand by change data capture?

0 Answers  


what is the difference between a primary key and a unique key? : Sql server database administration

0 Answers  


what is the difference between count(*) and count(1) ?

0 Answers   MCN Solutions,


If you are working on a SQL database and if suddenly a developer changes the code and your queries results start giving errors,how will you check using a T-SQL query (on system tables) that what has changed in the database.

2 Answers   Microsoft,


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?

0 Answers  


how we can count records as a group of days like sum of records for(four mondays),(four tuesday)........ in a month. group the column for weekdays.

1 Answers  


how can i store resumes in database?

3 Answers   HCL,


What are recommended options to be used while using db mirroring? : sql server database administration

0 Answers  


1.what is the difference between view and cursor? 2.If we do any change in view will it affect the database,similarly when we do changes in cursor will it affect the databse?with certain example?Thanks

5 Answers  


Difference between group by clause and having clause in SQL?

0 Answers   Flextronics,


what are the disadvantages of cursors? : Sql server database administration

0 Answers  


Categories