MAX in Teradata

In order to get the maximum value from a column in a table, MAX function can be used.

Example:
SELECT MAX(emp_id)
FROM tbl_employee;


Generally, MAX function will be used with GROUP BY clause to find the maximum value for each group.

Example:
SELECT MAX(emp_id), dept_id
FROM
tbl_employee
GROUP BY dept_id;


In the above example, the maximum emp_id for every dept_id will be displayed.
Please note that since MAX function can act independently, we don't need to add it in GROUP BY clause.