Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
mysql
min
communitycreator

What is MIN() in SQL?

Harris Amjad

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The MIN() function returns the minimum value from a set of values.

Figure 1 shows a visual representation of the MIN() function.

Figure 1: Visual representation of MIN() function

Syntax

MIN(column)

Parameter

The MIN() function takes the column or field as a parameter.

Return value

The MIN() function returns the minimum value from the set of valuescolumn name sent as a parameter.

Code

The following example shows how we can get the minimum student mark using the MIN() function.

Students

Student ID

Student Name

Student Marks

1

David

22

2

Luiss

20

3

Harvey

15

4

Lucy

25

5

Andrew

10

select MIN(studentMarks) as minStudentMarks
from Students

RELATED TAGS

sql
mysql
min
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring