Home >Database >Mysql Tutorial >How to Select Rows with NULL or Empty Values in a MySQL Column?

How to Select Rows with NULL or Empty Values in a MySQL Column?

Barbara Streisand
Barbara StreisandOriginal
2025-01-07 14:11:40256browse

How to Select Rows with NULL or Empty Values in a MySQL Column?

Accessing a column in a MySQL table that might contain null or empty values requires a method to check their validity. To identify rows with empty or null values, consider the following approach:

This query selects all rows where the column "some_col" is NULL or an empty string ('') regardless of any space characters:

SELECT * FROM table WHERE some_col IS NULL OR some_col = '';

The above is the detailed content of How to Select Rows with NULL or Empty Values in a MySQL Column?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn