Return to Snippet

Revision: 71312
at February 17, 2017 05:26 by bbrumm


Initial Code
SELECT * FROM student;

--Example 1
SELECT MAX(fees_paid) AS MAX_TEST
FROM student;

--Example 2
SELECT MAX(first_name) AS MAX_TEST
FROM student;

--Example 3
SELECT MAX(enrolment_date) AS MAX_TEST
FROM student;

--Example 4
SELECT TO_CHAR(enrolment_date, 'MON') AS ENROLMENT_MONTH,
MAX(fees_paid) as MAX_FEES
FROM student
GROUP BY TO_CHAR(enrolment_date, 'MON');

--Example 5
SELECT first_name, last_name, enrolment_date, MAX(fees_paid) OVER (PARTITION BY TO_CHAR(enrolment_date, 'MON'))  AS MAX_TEST
FROM student
ORDER BY last_name, first_name

Initial URL
http://www.databasestar.com/oracle-max/

Initial Description
A few examples of the MAX function.

Initial Title
Oracle MAX function

Initial Tags
sql, Oracle

Initial Language
SQL