Hi,
I will explain MIN() and MAX() Functions in Oracle SQL in this post of Oracle SQL Tutorial series.
Read the previous post of this tutorial series before this.
SQL SELECT Statement and DESC Command in Oracle SQL | Oracle SQL Tutorials -2
The MIN() function
You can find the smallest value of the selected column using the MIN() function.
MIN() Syntax
MIN() Function syntax is as follows.
SELECT MIN(column_name) FROM table_name;
SELECT MIN(column_name) FROM table_name
WHERE condition;
SQL> select min(salary) from hr.employees; MIN(SALARY) ----------- 3100 SQL>
SQL> select min(salary) from hr.employees where department_id>100; MIN(SALARY) ----------- 9300 SQL>
The MAX() function
You can find the Largest value of the selected column using the MAX() function.
MAX() Syntax
MAX() Function syntax is as follows.
SELECT MAX(column_name) FROM table_name;
SELECT MAX(column_name) FROM table_name
WHERE condition;
SQL> SQL> select max(salary) from hr.employees; MAX(SALARY) ----------- 23000 SQL> SQL> SQL> select max(salary) from hr.employees where department_id>100; MAX(SALARY) ----------- 13008 SQL>
Do you want to learn Oracle SQL Tutorial for Beginners, then read the following articles.
Oracle SQL Tutorials For Beginners – Learn Oracle SQL from scratch with Oracle SQL Online Course
Do you want to learn Oracle Database for Beginners, then read the following articles.
Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )