Return to Snippet

Revision: 71278
at February 4, 2017 05:58 by bbrumm


Initial Code
/*
MIN
*/

SELECT * FROM student;

--Example 1
SELECT MIN(fees_paid) AS MIN_TEST
FROM student;

--Example 2
SELECT MIN(last_name) AS MIN_TEST
FROM student;

--Example 3
SELECT MIN(enrolment_date) AS min_test
FROM student;


--Example 4
SELECT TO_CHAR(enrolment_date, 'MON') AS ENROLMENT_MONTH,
MIN(fees_paid) AS MIN_FEES
FROM student
GROUP BY TO_CHAR(enrolment_date, 'MON');


--Example 5
SELECT TO_CHAR(enrolment_date, 'MON') AS ENROLMENT_MONTH,
MIN(fees_paid) AS MIN_FEES
FROM student
GROUP BY TO_CHAR(enrolment_date, 'MON')
HAVING MIN(fees_paid) > 50;


--Example 6
SELECT first_name,
last_name,
enrolment_date,
MIN(fees_paid) OVER (PARTITION BY TO_CHAR(enrolment_date, 'MON'))  AS MIN_TEST
FROM student
ORDER BY last_name, first_name;

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

Initial Description
A few examples of the MIN function

Initial Title
Oracle MIN Function

Initial Tags
sql, Oracle

Initial Language
SQL