MAX, MIN & LIMIT

MAX() is used to find out the maximum value of a selected column. Where as MN() is used to find the minimum value. The use of both max and min is very simple in MYSQL, even a child can learn to use it!

SYNTAX:

MAX() :

Select MAX(columnname)
From tablename
Where condition;

MIN():

Select MIN(columnname)
From tablename
Where condition;

Example

Select MAX(Class) , MIN(Score)
from students;

LIMIT

This clause is used to specify the number of rows to be returned after applying a specific query to the table. It is useful in cases where we have very large tables and we need to see only few values from the table. if we return a large number of records it may affect the performance.

Syntax:

select columnname 
from tablename 
Where condition 
LIMIT number;

Example

select * from students
LIMIT 2;

Leave a comment

Create a website or blog at WordPress.com

Up ↑

Design a site like this with WordPress.com
Get started