Sunday, May 29, 2011

.NET and SQL Server interview questions - Show SQL query in order to obtain names of employees with top 10 salaries?

Answer:

Let’s see a simple example to see, how exactly we can obtain entire employee
name who obtains top 10 salaries.

Assuming that we have following table for Employee.




Query:-

select Employee.EmpName,Employee.EmpSalary from Employee where Employee.EmpSalary in
(select distinct top(10)Employee.EmpSalary from Employee order by Employee.EmpSalary desc)

OUTPUT:-




You will be also interested in watching the below video, which are also
asked in most of the interviews and favourable question of interviewers.




Please click here to see more .NET and SQL Server interview questions

Regards,

Visit Authors blog for more .NET and SQL Server interview Question

No comments: