/ Published in: SQL
A few examples of the MAX function.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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
URL: http://www.databasestar.com/oracle-max/