Join WhatsApp Channel Join Now
Join WhatsApp Group Join Now
Telegram Channel Join Now

Wednesday, 15 July 2015

SQL Query to get Department wise Maximum Salary Employee Details from SQL server Table

Freshersjunction ready to give explanation about how to write a “SQL Query to get Department wise Maximum Salary Employee Details from SQL server Table”.

                In any Technical interview, most frequently asked technical question from interviewer are (If you are in SQL Server Platform)

1. “SQL Query To Get Highest Salary Employee Details In A Employee Table

2. ” SQL Query To Get Top 2 Highest Salary Employee Details In a SQL Server Table

3. “SQL Query to get Department wise Maximum Salary Employee Details from SQL server Table”

First two topics are we already explain. Now FreshersJunction gives explanation of third topic I.e., “SQL Query to get Department wise Maximum Salary Employee Details from SQL server Table”

                Before writing a SQL Query for Department wise Maximum Salary Employee Details, we need to create employee (--Table name) table.

                How to create a Table in SQL Server

So now we can see employee table below. In the Employee table eno, salary, ename, dno, managerID are column names
sql-server-employee-table

SQL Query for Department wise Maximum Salary Employee Details is

Select * from employee e where salary = (
                                                      select MAX(salary)from employee d where e.dno =d.dno
                                                                      )

For the Above SQL Query output is as following table
top-2-query


                           From the above table you can clearly observe that “naresh” has highest salary in department number 10 (dno = 10) and “Mahesh” has highest salary in department number 20 (dno =20)

FreshersJunction blog hopes now you can get clear idea about “How to write a query for SQL Query for Department wise Maximum Salary Employee Details”

Note : Bookmark this page by pressing Ctrl+D , Then it may easy for you to revision

Conclusion: Anybody have any doubt about “SQL Query for Department wise Maximum Salary Employee Details” topic then comment here, we are ready to help you 24*7

You may also search in Google as:
FreshersJunction – Department wise maximum salary employee details , SQL query to get MAX salary employee details department wise, employee details department wise with maximum salary, maximum salary department wise in SQL Sever, SQL Query to get Department wise Maximum Salary Employee Details from SQL server Table, How to write SQL Query to get Department wise Maximum Salary Employee Details from SQL server Table.

0 comments:

 
close

Join Telegram Channel

Join FreshersJobsUpdates - Your Job Search End Here

Click Here To Join Telegram Channel