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