
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Get the minimum value from a list with multiple columns in MySQL?
Let us first create a table −
mysql> create table DemoTable756 ( Value1 int, Value2 int, Value3 int ); Query OK, 0 rows affected (0.62 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable756 values(10,20,14); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable756 values(20,34,17); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable756 values(200,134,789); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable756 values(139,98,99); Query OK, 1 row affected (0.17 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable756;
This will produce the following output -
+--------+--------+--------+ | Value1 | Value2 | Value3 | +--------+--------+--------+ | 10 | 20 | 14 | | 20 | 34 | 17 | | 200 | 134 | 789 | | 139 | 98 | 99 | +--------+--------+--------+ 4 rows in set (0.00 sec)
Following is the query to get minimum value from a list with multiple columns −
mysql> select least(Value1,Value2,Value3) from DemoTable756;
This will produce the following output -
+-----------------------------+ | least(Value1,Value2,Value3) | +-----------------------------+ | 10 | | 17 | | 134 | | 98 | +-----------------------------+ 4 rows in set (0.00 sec)
- Related Articles
- How to calculate value from multiple columns in MySQL?
- Get the minimum and maximum value from a VARCHAR column and display the result in separate MySQL columns?
- Get minimum value from a column (floating values) with corresponding duplicate ids in MySQL
- Get MySQL maximum value from 3 different columns?
- MySQL multiple COUNT with multiple columns?
- Count value for multiple columns in MySQL?\n
- MySQL query to get the highest value from a single row with multiple columns\n\n\n\n\n\n\n\n\n\n
- Get the highest score value from a single column and the greatest from two columns in MySQL
- How to find the element from a Python list with a minimum value?
- How to check multiple columns for a single value in MySQL?
- Find minimum score from the entire four columns of a table in MySQL
- Select multiple Book Titles that share the minimum (PRICE) value in MySQL?
- Fetch maximum value from multiple columns with null and non-null values?
- How to create conditions in a MySQL table with multiple columns?
- Concatenate multiple rows and columns in a single row with MySQL

Advertisements