SQL Aggregate Function


In sql, MIN() function returns the minimum value from the selected column having numeric value.

Syntax for MIN()

SELECT MIN(column_name)
FROM table_name
WHERE condition;

Example on MIN()

We will use 'tih_Courses' table for demonstration purpose

Course_ID Course_Name Professor Mode_of_Training Course_Fee
001 .Net Mukesh Tiwari Online and Offline 550
002 Java Rajneesh Shukla Online and Offline 550
003 ANSI SQL Rajneesh Shukla Online 500
004 Basics of Computer Shweta  Online 350
005 Blogging Tutorial Puja  Online 250
006 JSP Alok Pandey Online and Offline 350
007 Servlet Mukesh Tiwari Online and Offline 350
008 Spring Anup Shukla Online 650
Query-1: Write a sql query to find minimum course fee from among all the courses
SELECT MIN(Course_Fee)
FROM tih_Courses

After above sql query gets executed, we will get following result:


Query-2: Write a sql query to calculate the minimum course fee of Professor Mukesh Tiwari

SELECT MIN(Course_Fee)
FROM tih_Courses
WHERE Professor = 'Mukesh Tiwari';

After above sql query gets executed, we will get following result:


Similarly we can use MIN() on different column having numeric value applying different condition to get the mimimum result.

Please Share this page
Views : 83
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!