Skip to content
Related Articles

Related Articles

SQL MIN() and MAX()
  • Last Updated : 14 Aug, 2020
  1. SQL MIN() Functions
    The MIN() function provides the smallest value of the chosen column.

    MIN() Syntax –

    SELECT MIN(column_name)
    FROM table_name
    WHERE condition;
    
  2. SQL MAX() Functions
    The MAX() function provides the largest value of the chosen column.

    MAX() Syntax –

    SELECT MAX(column_name)
    FROM table_name
    WHERE condition;
    



Let us assume, we have below table “GeeksTable” :



NameCityNumberSalaryDOB
AbcDelhi12340004-Aug
DefMumbai34530007-June
MnoDelhi56729009-April
AbcNoida457345012-July
XyzJaipur87687509-March
KlmDelhi234550023-January

  1. MIN() Example :
    The following SQL statement finds the lowest salary product :
    SELECT MIN(Salary) FROM GeeksTable;

    Output –

    2900
  2. MAX() Example :
    The following SQL statement finds the highest salary :
    SELECT MAX(Price) FROM GeeksTable; 

    Output –

    8750
    
My Personal Notes arrow_drop_up
Recommended Articles
Page :