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

Friday 10 July 2015

SQL Query To Get Highest Salary Employee Details In A Employee Table

Now, here we are discussing about “How to write a SQL Query To Get Highest Salary Employee Details In A Employee Table”.

                When you are in interview on the technology of SQL Server, the most important Technical interview question is write a SQL Query To Get Highest Salary Employee Details?

                You should answer this question in interview because this is the most basic question in SQL Server. If you are not given correct answer, then interviewer fixed as you don’t have basic knowledge on SQL Sever.

For example the employee table is as follows (How to create Table in SQL Server?)
SQL-server-employee-table

-          employee is a table name
-          eno, sal, ename, dno, mgrid are column names

         If you writing the SQL query for Highest Salary Employee Details In A Employee Table as

                                         “Select max(sal) from employee” ,

        then the interviewer fixed as you have basic knowledge on SQL Server.

                Because the output of above Query is as follows

output-of-above-Query-images


In the above output you can clearly observe it shows only highest salary in table, but it didn’t show which employee have the highest salary.

                So the exact answer for “SQL Query To Get Highest Salary Employee Details In A Employee Table” is

 Select * from employee where sal = (Select max(sal) from employee)

The output of above query is as follows

output-of-above-query-sql-server


Note : Book mark (Press CTRL +D) this page to review once again before going to Interview

One More Important Technical interview Question is “The Difference between varchar and varchar2

   For Latest Walkins in Bangalore, Hyderabad and Chennai Click here

Conclusion: If you have any Queries related to “How to write a SQL Query To Get Highest Salary Employee Details In A Employee Table”.  Then comment here, we are ready to help you.

You may also search in Google as:
FreshersJunction – SQL query for Highest Salary, How to write SQL query for Highest Salary, SQL Query To Get Highest Salary Employee Details,  highest employee salary SQL Query, SQL Query To Get Highest Salary Employee Details In A Employee Table, How to write a SQL Query To Get Highest Salary Employee Details In A Employee Table, highest salary query in SQL Server.

1 comments:

Unknown said...

Application .Net

 
close

Join Telegram Channel

Join FreshersJobsUpdates - Your Job Search End Here

Join Telegram Channel