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
Release: 2025-01-07 14:11:40
Original
204 people have browsed it

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 = '';
Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template