How to use MAX() and MIN() Function in SQL

Introduction

In this blog, I will tell you how to use max and min function to find out the maximum and minimum value.

Description

Here we are finding the maximum and minimum value by using the sql. Here First we make a table which have two column, first column name is name and second column name is marks. So here we find the maximum and minimum marks from the table. So there is a table which is shown below:

sql3.jpg

  • MAX()

For finding the maximum value from the table we use max function.

Syntax

SELECT MAX (column_name) FROM table_name

Example For MAX() Function

SELECT MAX (marks)As MaximumMarks FROM akash3

Output

sql4.jpg

 

  • MIN()

For finding the minimum value from the table we use min function.

Syntax

SELECT MIN (column_name) FROM table_name

Example For MIN() Function

SELECT MIN(marks) As MinimumMarks FROM akash3

Output

sql5.jpg