如何检查 MySQL 中的列是空的还是空的?

2021-11-20 00:00:00 sql mysql

我在表中有一列可能包含空值或空值.如何检查表中存在的行中的列是空的还是空的?

I have a column in a table which might contain null or empty values. How do I check if a column is empty or null in the rows present in a table?

(e.g. null or '' or '  ' or '      ' and ...)

推荐答案

这将选择 some_colNULL'' 的所有行(空字符串)

This will select all rows where some_col is NULL or '' (empty string)

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

相关文章