Here we write a sql query to find max,min and average salary of employee table in Oracle database.
- First we have created one Employee table.
- In that table there are 5 column id, name, age, address and salary.
- The MIN() function returns the smallest value of the selected column in Employee Table.
- The MAX() function returns the largest value of the selected column in Employee Table.
- The AVG() function returns the average value of a numeric column in Employee Table.
select * from Employee;
ID | NAME | AGE | ADDRESS SALARY |
1 | Santosh | 25 | Mumbai 1500 |
2 | Aman | 23 | Bangalore 2000 |
3 | Ravi | 25 | Pune 6500 |
4 | Vijay | 27 | Chennai 8500 |
5 | Pankaj | 22 | Chennai 10000 |
6 | Sany | 24 | Mumbai 4500 |
select MAX(Salary) as Max_Salary,MIN(salary) as Min_salary,AVG(salary) as Avg_Salary from Employee;
MAX_SALARY | MIN_SALARY | AVG_SALARY | |
10000 | 1500 | 5500 |