Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in SQL by (20.3k points)

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 ...)

1 Answer

0 votes
by (40.4k points)

Try this code:

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

The above code will select all rows where some_col is NULL or '' (empty string).

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 19, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Jul 12, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
0 votes
1 answer
asked Dec 22, 2020 in SQL by Appu (6.1k points)

Browse Categories

...