Node.js MySQL NULL Values Last Updated : 07 Oct, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report In this article, will learn to handle NULL values and make Query on the basis of NULL values. Syntax: IS NULL; IS NOT NULL; Return Value:'IS NULL' returns the row in the column which contains one or more NULL values.'IS NOT NULL' returns the row in the column which does not contains any NULL values. 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 * FROM users WHERE address IS NULL"; 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 * FROM users WHERE address IS NOT NULL"; db_con.query(query, (err, rows) => { if(err) throw err; console.log(rows); }); }); Output: Comment More infoAdvertise with us Next Article Node.js MySQL Drop Table P pratikraut0000 Follow Improve Article Tags : Technical Scripter Web Technologies Node.js Technical Scripter 2020 NodeJS-MySQL +1 More Similar Reads Node.js MySQL Drop Table DROP TABLE Query is used to Delete or Drop a table from MySQL Database. Syntax: This will delete users table. But this will throw error if users table is not there. DROP TABLE users This will delete users table only if it exist. DROP TABLE IF EXISTS users Modules: mysql: To handle MySQL connection a 2 min read Node.js MySQL Select from Table Introduction: Learn about Selecting data from MySQL database using node.js. We are going to use standard SELECT FROM SQL Query. Syntax: SELECT [column] FROM [table_name] Example: 1) SELECT * FROM customers selecting all columns from customers table. 2) SELECT name, address FROM customers SQL users T 1 min read Node.js MySQL Create Table Introduction: Learn to create a table in MySQL database using NodeJS. We will see how to use the Create Table command in NodeJS using the MySQL module. Prerequisite: Introduction to NodeJS MySQL Setting up environment and Execution: Step 1: Create a NodeJS Project and initialize it using the followi 2 min read Node.js MySQL Update Statement Node.js is an open-source platform for executing JavaScript code on the server-side. It can be downloaded from here. MySQL is an open-source Relational Database Management System (RDBMS) that uses Structured Query Language (SQL). It is the most popular language for adding, accessing, and managing co 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 Delete Query We use SQL DELETE Query to delete data with some condition from MySQL Table. Syntax: This will delete all rows of customers' tables but everything else will remain as it is (indexing, etc). DELETE FROM users This will delete all rows of users table where userId is 2. DELETE FROM users WHERE userId = 2 min read Like