MariaDB MIN() function is used to retrieve the minimum value of the expression.
MIN () can take string argument too, in which case it returns the minimum string values.
MIN() returns NULL if there were no matching rows.
Syntax:
SELECT MIN(aggregate_expression)
FROM tables
[WHERE conditions];
Example
We have a table "Student", having the following data:
MariaDB Min function
Let's retrieve lowest salary by using MIN () function.
SELECT MIN(salary) AS "Lowest Salary"
FROM Student;
Output:
MariaDB interview questions
Let's take another example:
MariaDB interview questions
SELECT name, MIN(score) FROM student GROUP BY name;
MariaDB Min function
To check MIN string:
SELECT MIN(name) FROM student;
MariaDB interview questions