Node.js MySQL Min() Function Last Updated : 07 Oct, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report We will be using Min() function in MySQL to get Minimum value from some particular column. Syntax: MIN(column_name) Parameters: MIN() function accepts a single parameter as mentioned above and described below. column_name: Column’s name from which we have to return the min value. Return Value: MIN() function returns the minimum value from the particular column in the table. Module Installation: Install the MySQL module using the following command. npm install mysql Database: Our SQL publishers table preview with sample data is shown below. Example 1: index.js const mysql = require("mysql"); let db_con = mysql.createConnection({ host: "localhost", user: "root", password: '', database: 'gfg_db' }); db_con.connect((err) => { if (err) { console.log("Database Connection Failed !!!", err); return; } console.log("We are connected to gfg_db database"); // Here is the query let query = "SELECT MIN(salary) AS min_salary FROM publishers"; db_con.query(query, (err, rows) => { if(err) throw err; console.log(rows); }); }); Output: Example 2: index.js const mysql = require("mysql"); let db_con = mysql.createConnection({ host: "localhost", user: "root", password: '', database: 'gfg_db' }); db_con.connect((err) => { if (err) { console.log("Database Connection Failed !!!", err); return; } console.log("We are connected to gfg_db database"); // Here is the query let query = "SELECT MIN(salary) AS min_salary FROM publishers WHERE id < 7"; db_con.query(query, (err, rows) => { if(err) throw err; console.log(rows); }); }); Output: Comment More infoAdvertise with us Next Article Node.js MySQL Min() Function P pratikraut0000 Follow Improve Article Tags : Technical Scripter Web Technologies Node.js Technical Scripter 2020 NodeJS-MySQL +1 More Similar Reads Node.js MySQL MID() Function MID() Function is a Builtin Function in MySQL which is used to get substring of input string between given range inclusive. Syntax: MID(input_string, from, length) Parameters: MID() function accepts three parameters as mentioned above and described below. input_string: Substring of this input will b 2 min read Node.js MySQL LTRIM() Function LTRIM() Function is a Builtin Function in MySQL which is used to trim all spaces from left side of input string. Syntax: LTRIM(string) Parameters: LTRIM() function accepts a single parameters as mentioned above and described below. string: String needed to be trimmed from left side Return Value: LTR 2 min read Node.js MySQL LEFT() Function LEFT() Function is a Builtin function in MySQL which is used to get Prefix of a specific size of Given String. Syntax: LEFT(input_string, size_of_prefix) Parameters: LEFT() function accepts two parameters as mentioned above and described below. input_string: We will get prefix of this input stringsi 2 min read Node.js MySQL LENGTH() Function LENGTH() Function is a Builtin function in MySQL which is used to get length of given string in bytes. Syntax: LENGTH(input_string) Parameters: LENGTH() function accepts a single parameter as mentioned above and described below. input_string: We will get number of characters of this string Return Va 2 min read Node.js MySQL LPAD() Function LPAD() Function is a Builtin function in MySQL which is used to attach a given string to text from left side till total length is equal to given value. If the given string is small then it is repeated multiple times. Syntax: LPAD(text, total_length, string) Parameters: LPAD() function accepts three 2 min read Like