InterviewSolution
Saved Bookmarks
| 1. |
SQL Query to find min, max and average salary from a table? |
||||||||
|
Answer» Suppose ASSUME the table is in the format shown below,: Employee table:
To FIND the maximum salary, SELECT MAX(Salary) from Employee; // To just get the max salarySELECT * from Employee where Salary = (SELECT MAX(Salary) from Employee); // Employees with highest salaryTo find the average salary, SELECT AVG(Salary) from Employee;To find the MINIMUM salary, SELECT MIN(Salary) from Employee; // To just get the min salarySELECT * from Employee where Salary = (SELECT MIN(Salary) from Employee); // Employees with lowest salaryUseful Interview Resources
|
|||||||||