Node.js MySQL FIND_IN_SET() Function Last Updated : 17 Feb, 2021 Comments Improve Suggest changes Like Article Like Report FIND_IN_SET() function is a built-in function in MySQL that is used to get the position of the first occurrence of value string in a list of strings separated by comma(','). Syntax: FIND_IN_SET(value, list_of_string)Parameters: It takes two parameters as follows: value: It is the value to be searched.list_of_string: It is the list of strings separated by comma (',').Return Value: It returns the position of first occurrence of value string in a list of string separated by comma (',') Module Installation: Install the mysql module using the following command: npm install mysqlDatabase: 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 FIND_IN_SET('2', '1,12,2,32') 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: Advance Example 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 sub_query = "(SELECT GROUP_CONCAT(name) FROM publishers)"; let main_query = `SELECT FIND_IN_SET('lily', ${sub_query}) AS lily_position`; db_con.query(main_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 Node.js MySQL FIND_IN_SET() 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 FIELD() Function FIELD() function is a built-in function in MySQL that is used to get the position of the first occurrence of a value in a set of expressions. In the case of string values, it is not case-sensitive. Syntax: FIELD(value, input_1, input_2, input_3, ...)Parameters: It takes two parameters as follows: va 2 min read Node.js MySQL INSTR() Function INSTR() function is a built-in function in MySQL that is used to get the position of the first occurrence of pattern in the text. Note: In NodeJs MySQL, INSTR() function is not case sensitive. Syntax: INSTR(text, pattern)Parameters: It takes two parameters as follows: text: It is the given text in w 2 min read Node.js MySQL UCASE() Function UCASE() function is a builtin function in MySQL that is used to convert all characters of a given string to uppercase. Syntax: UCASE(input_string)Parameters: It takes one parameter as follows: input_string: It is the string that is passed for converting this string to uppercase.Return Value: It retu 2 min read Node.js MySQL SUM() Function We use the SUM() function in MySQL to get Sum of the value of some columns. Syntax: SUM(column_name) Parameters: SUM() function accepts a single parameter as mentioned above and described below. column_name: Columnâs name from which we have to return the max value. Module Installation: Install the m 2 min read Node.js MySQL INSERT() Function INSERT() function is a built-in function in MySQL that is used to insert a string into another string at some position after deleting some characters from it. Syntax: INSERT(string_1, position, number_of_characters_to_delete, string_2)Parameters: It takes four parameters as follows: string_1: It is 2 min read Like