Node.js MySQL CHARACTER_LENGTH() Function Last Updated : 17 Feb, 2021 Comments Improve Suggest changes Like Article Like Report CHARACTER_LENGTH() function is a built-in function in MySQL that is used to get a number of characters in a given string. Syntax: CHARACTER_LENGTH(input_string)Parameters: It takes one parameter as follows: input_string: We will get number of characters of this string.Return Value: It returns a number of characters in a given string. 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 CHARACTER_LENGTH('Geeks for Geeks') AS output"; db_con.query(query, (err, rows) => { if(err) throw err; console.log(rows); }); }); Run the index.js file using the following command: node index.jsOutput: 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 CHARACTER_LENGTH(name) AS name_length FROM publishers"; db_con.query(query, (err, rows) => { if(err) throw err; console.log(rows); }); }); Run the index.js file using the following command: node index.jsOutput: Comment More infoAdvertise with us Next Article CHARACTER_LENGTH() Function in MySQL P pratikraut0000 Follow Improve Article Tags : Technical Scripter Web Technologies Node.js Technical Scripter 2020 NodeJS-MySQL +1 More Similar Reads Node.js MySQL CHAR_LENGTH() Function CHAR_LENGTH() function is a built-in function in MySQL that is used to get a number of characters in a given string. Syntax: CHAR_LENGTH(input_string)Parameters: It takes one parameter as follows: input_string: It is the given string whose length is to be determined.Return Value: It returns a number 2 min read CHARACTER_LENGTH() Function in MySQL CHARACTER_LENGTH() : This function in MySQL helps to find the length of given string. The length is measured in form of characters. Moreover, CHARACTER_LENGTH() is also the synonym of CHAR_LENGTH() function. Syntax : CHARACTER_LENGTH(string) Parameter : The function accepts only one parameter as fol 1 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 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 FORMAT() Function FORMAT() function is a built-in function in MySQL that is used to format input numbers in the format of ...**, ***, *** also, round float numbers to a specific number of decimal places. Syntax: FORMAT(number, number_of_decimal_places)Parameters: It takes two parameters as follows: number: The number 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 Like