
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to check if any value is Null in a MySQL table single row?
For this, you can use ISNULL in MySQL.
Let us create a table −
Example
mysql> create table demo86 -> ( -> value1 varchar(20) -> , -> value2 varchar(20) -> ); Query OK, 0 rows affected (2.77
Insert some records into the table with the help of insert command −
Example
mysql> insert into demo86 values(null,null); Query OK, 1 row affected (0.34 mysql> insert into demo86 values(null,'John'); Query OK, 1 row affected (0.16 mysql> insert into demo86 values('David','Mike'); Query OK, 1 row affected (0.17 mysql> insert into demo86 values('Sam',null); Query OK, 1 row affected (0.15
Display records from the table using select statement −
Example
mysql> select *from demo86;
This will produce the following output −
Output
+--------+--------+| value1 | value2 |
+--------+--------+| NULL | NULL |
| NULL | John || David | Mike |
| Sam | NULL |+--------+--------+
4 rows in set (0.00 sec)
Following is the query to check if any value is Null in a single row −
Example
mysql> select *from demo86 -> where value1 is null or value2 is null;
This will produce the following output −
Output
+--------+--------+| value1 | value2 |
+--------+--------+| NULL | NULL |
| NULL | John || Sam | NULL |
+--------+--------+3 rows in set (0.00 sec)
- Related Articles
- How to check if data is NULL in MySQL?
- Write a single MySQL query to return the ID from the corresponding row which is a NOT NULL value
- Return value from a row if it is NOT NULL, else return the other row value in another column with MySQL
- Is there any way to check if there is a null value in an object or array in JavaScript?
- How to prevent MySQL GROUP BY from collapsing NULL values into a single row?
- How to check if field is null or empty in MySQL?
- How can we delete a single row from a MySQL table?
- How to check if any value is NaN in a Pandas DataFrame?
- In MySQL stored procedures, how to check if a local variable is null?
- How to check whether column value is NULL or having DEFAULT value in MySQL?
- How to check multiple columns for a single value in MySQL?
- Display NULL and NOT NULL records except a single specific value in MySQL
- How can I customize value, instead of NULL, of a row by using MySQL IF() function?
- Check if a value exists in a column in a MySQL table?
- How do I check if a column is empty or null in MySQL?

Advertisements