Menu

Friday, 21 February 2014

MAX() Function



It is used to findout maximum value of numerical column.


EmployeeID
EmployeeName
EmployeeMobNo
EmployeeSalary
1
Mayank Dixit
9532771738
20000
2
Mona Dixit
9005408263
15000
3
Purnima
9485754875
26522
4
Payal
9785458545
19856

                                                               Employee

In the above table (employee), we want to findout the max salary of employee (EmployeeSalary).


Syntax


SELECT MAX(Column_Name) AS Alias_Column_Name

FROM Table_Name;


Example


SELECT MAX(EmployeeSalary) AS Salary_OF_Employee

FROM Employee;

Here Salary_OF_Employee is a subname (alias) of column.


Output:-

Salary_OF_Employee
26522


in the above output, we find 26522 maximum salary_of_employee.

No comments: