Blog

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

Posted by Akash Garg Blogs | SQL Apr 10, 2013
In this blog I will provide a quick overview of how to use the max and min functions 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

COMMENT USING
PREMIUM SPONSORS
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.
SPONSORED BY
  • MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.