How to Get the Minimum and maximum Value of a Column of a MySQL Table Using Python? Last Updated : 23 Dec, 2020 Comments Improve Suggest changes Like Article Like Report Prerequisite: Python: MySQL Create Table In this article, we are going to see how to get the Minimum and Maximum Value of a Column of a MySQL Table Using Python. Python allows the integration of a wide range of database servers with applications. A database interface is required to access a database from Python. MySQL Connector-Python module is an API in python for communicating with a MySQL database. Database in use: We are going to use geeks(Database name) database and table describing the salary. Approach: Import module.Make a connection request with the database.Create an object for the database cursor.Execute the following MySQL query:SELECT MIN(Column_name) AS minimum FROM Table_name. SELECT MAX(Column_name) AS minimum FROM Table_name.And print the result. Example 1: Getting the minimum value of a column. Python3 # Establish connection to MySQL database import mysql.connector mydb = mysql.connector.connect( host = "localhost", user = "root", password = "root123", database = "geeks" ) # Create a cursor object cursor = mydb.cursor() # Execute the query cursor.execute("SELECT MIN(Value) AS minimum FROM salary") result = cursor.fetchall() for i in result: maximum= float(i[0]) print(maximum) # Close database connection mydb.close() Output: 200.0 Example 2: Getting the maximum value of a column. Python3 # Establish connection to MySQL database import mysql.connector mydb = mysql.connector.connect( host = "localhost", user = "root", password = "root123", database = "geeks" ) # Create a cursor object cursor = mydb.cursor() cursor.execute("SELECT MAX(Value) AS maximum FROM salary") result = cursor.fetchall() for i in result: maximum = float(i[0]) print(maximum) # Close database connection mydb.close() Output: 350030.0 Comment More infoAdvertise with us Next Article How to Get the Minimum and maximum Value of a Column of a MySQL Table Using Python? kumar_satyam Follow Improve Article Tags : Python Python-mySQL Practice Tags : python Similar Reads How to Compute the Average of a Column of a MySQL Table Using Python? A MySQL connector is needed to generate a connection between Python and the MySQL server. Here we will import mysql.connector library to get the average of the specified column in the given database. If you need to know how to install MySQL, see How to Install MySQL in Python 3. Average Function of 2 min read How to Concatenate Column Values of a MySQL Table Using Python? Prerequisite: Python: MySQL Create Table In this article, we show how to concatenate column values of a MySQL table using Python. We use various data types in SQL Server to define data in a particular column appropriately. We might have requirements to concatenate data from multiple columns into a s 2 min read How to Compute the Sum of All Rows of a Column of a MySQL Table Using Python? MySQL server is an open-source relational database management system that is a major support for web-based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web. In order to access MySQL databases from a w 2 min read How to Add a Column to a MySQL Table in Python? Prerequisite: Python: MySQL Create Table Python allows the integration of a wide range of database servers with applications. A database interface is required to access a database from Python. MySQL Connector-Python module is an API in python for communicating with a MySQL database.  ALTER statemen 4 min read How to Get the minimum value from the Pandas dataframe in Python? In this article, we will discuss how to get the minimum value from the Pandas dataframe in Python. We can get the minimum value by using the min() function Syntax: dataframe.min(axis) where, axis=0 specifies columnaxis=1 specifies rowGet minimum value in dataframe row To get the minimum value in a 2 min read How to Get the maximum value from the Pandas dataframe in Python? Python Pandas max() function returns the maximum of the values over the requested axis. Syntax: dataframe.max(axis) where, axis=0 specifies columnaxis=1 specifies rowExample 1: Get maximum value in dataframe row To get the maximum value in a dataframe row simply call the max() function with axis set 2 min read How to Count the Number of Rows in a MySQL Table in Python? MySQL server is an open-source relational database management system which is a major support for web-based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web. In order to access MySQL databases from a 2 min read Adding new enum column to an existing MySQL table using Python Prerequisite: Python: MySQL Create Table In this article, we are going to see how to add a new enum column to an existing MySQL table using Python. Python allows the integration of a wide range of database servers with applications. A database interface is required to access a database from Python. 1 min read How to Perform Arithmetic Across Columns of a MySQL Table Using Python? Python is a dynamic language, and Python applications can be integrated with database servers. The module used to access a MySQL database from Python is MySQL Connector Python. PyMySQL, MySQLDB and mysqlclient are other Python modules to communicate with a MySQL database server in Python. However, w 5 min read Find the sum and maximum value of the two column in excel file using Pandas In these articles, we will discuss how to read data from excel and perform some mathematical operation and store it into a new column in DataFrame. Suppose our excel file looks like this. sample_data.xlsx Then we have to compute the sum of two-column and find out the maximum value and store into a n 2 min read Like