Select *
From Table
Where (col is null or col = '')

Or

Select *
From Table
Where IsNull(col, '') = ''
Answer from codingbadger on Stack Overflow
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_null_values.asp
SQL NULL Values - IS NULL and IS NOT NULL
SELECT column_names FROM table_name ... a selection from the Customers table used in the examples: The IS NULL operator is used to test for empty values (NULL values)....
Discussions

What is a null in sql? is it the same as a empty cell?
NULL, in simplest terms, is the absence of data. Not to be confused with '', an empty string. If you are familiar with other languages, you could think of it as similar to undefined, in that the column has a type defined, but the specific cell has no data, and is more of a place holder for future data. When filtering for NULL, you will need to do things like table.col is null or table.col is not null In your Excel example, it depends on how you import the data, and what the definition of the target table is. The target table may have rules built into it to default the data for certain columns, or reject NULL values from other columns. You could have Null, an empty string, zero, weird dates.. etc. More on reddit.com
๐ŸŒ r/learnSQL
10
13
October 5, 2022
design - SQL: empty string vs NULL value - Software Engineering Stack Exchange
Let's suppose I have a table with ... columns is an email address with varchar type. We assume that for some reason some people might not want to provide an email address. When inserting such data (without email) into the table, there are two available choices: set cell to NULL or set it to empty string (''). Let's assume that I'm aware of all the technical implications of choosing one solution over another and I can create correct SQL queries for ... More on softwareengineering.stackexchange.com
๐ŸŒ softwareengineering.stackexchange.com
December 30, 2010
feature comparison - When to use NULL and when to use an empty string? - Database Administrators Stack Exchange
On the other side, when concatenating strings in Oracle. NULL varchars are treated as empty strings. ... When you want to express explicitly, that a value is assigned, you have to use something like ' '. And you have to worry whether trimming not empty results in NULL ยท select case when ltrim(' ') is null then 'null' else 'not null' end from dual ... Now looking at DBMS where '' is not identical to NULL (e.g. SQL... More on dba.stackexchange.com
๐ŸŒ dba.stackexchange.com
Check the Variable is Empty or Null โ€“ SQLServerCentral Forums
If you see the "greater than" sign, ... than an empty string and null values will return "unknown" which isn't true. Luis C. General Disclaimer: Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?How to post data/code on a forum to get the best help: Option 1 / Option 2 ... Cool. I never knew you could do that, very interesting :laugh: Edit: sql code tag messed ... More on sqlservercentral.com
๐ŸŒ sqlservercentral.com
September 9, 2014
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_isnull.asp
W3Schools.com
SQL Create DB SQL Drop DB SQL Backup DB SQL Create Table SQL Drop Table SQL Alter Table SQL Constraints SQL Not Null SQL Unique SQL Primary Key SQL Foreign Key SQL Check SQL Default SQL Index SQL Auto Increment SQL Dates SQL Views SQL Injection SQL Hosting SQL Data Types ... ADD ADD CONSTRAINT ALL ALTER ALTER COLUMN ALTER TABLE AND ANY AS ASC BACKUP DATABASE BETWEEN CASE CHECK COLUMN CONSTRAINT CREATE CREATE DATABASE CREATE INDEX CREATE OR REPLACE VIEW CREATE TABLE CREATE PROCEDURE CREATE UNIQUE INDEX CREATE VIEW DATABASE DEFAULT DELETE DESC DISTINCT DROP DROP COLUMN DROP CONSTRAINT DROP DATAB
๐ŸŒ
Medium
medium.com โ€บ @esegui โ€บ isnull-in-sql-server-and-other-null-functions-72ada1a98e56
ISNULL in SQL Server (and other NULL functions) | by Emmanuel Segui | Medium
April 22, 2024 - If the check_expression is not NULL, the ISNULL function will return the check_expression. ... In this example, the FirstName and LastName columns from the Employees table are checked for NULL values. If either column contains a NULL value, the ISNULL function will replace it with the string โ€˜N/Aโ€™.
๐ŸŒ
Alibaba Cloud Community
alibabacloud.com โ€บ blog โ€บ when-to-use-null-and-when-to-use-empty-string_598579
When to Use NULL and When to Use Empty String - Alibaba Cloud Community
February 9, 2022 - Both statements insert value in the phone column. However, the first query insets a NULL value, and the second inserts an empty string. The first one could be interpreted as an unknown number, and the second could be interpreted as the user has no phone number. NULL works well when a UNIQUE field is set.
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ mysql โ€บ mysql_null_values.asp
MySQL NULL Values - IS NULL and IS NOT NULL
SELECT column_names FROM table_name ... the "Customers" table in the Northwind sample database: The IS NULL operator is used to test for empty values (NULL values)....
๐ŸŒ
Coginiti
coginiti.co โ€บ home โ€บ beginner โ€บ sql is null
What is the IS NULL Operator in SQL? - Coginiti
September 25, 2023 - The SQL IS NULL is an operator that tests for NULL (or empty) values in a column.
๐ŸŒ
Mimo
mimo.org โ€บ glossary โ€บ sql โ€บ is-null
SQL IS NULL Condition: Syntax, Usage, and Examples
The SQL IS NULL condition helps you check if a column contains no value, meaning it's undefined or missing. In relational databases, NULL represents the absence of data, not zero or an empty string.
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ sql queries โ€บ find null or empty values in sql
Find Null or Empty Values in SQL Baeldung on SQL
August 20, 2025 - When applied to a column containing an empty value, it returns NULL, allowing us to check for NULL using the IS NULL operator. While not part of the ANSI SQL standard, NULLIF is a common function available in popular database systems like ...
Top answer
1 of 11
92

Let's say that the record comes from a form to gather name and address information. Line 2 of the address will typically be blank if the user doesn't live in apartment. An empty string in this case is perfectly valid. I tend to prefer to use NULL to mean that the value is unknown or not given.

I don't believe the physical storage difference is worth worrying about in practice. As database administrators, we have much bigger fish to fry!

2 of 11
28

I do not know about MySQL and PostgreSQL, but let me treat this a bit generally.

There is one DBMS namely Oracle which doesn't allow to choose it's users between NULL and ''. This clearly demonstrates that it is not necessary to distinguish between both. There are some annoying consequences:

You set a varchar2 to an empty string like this:

Update mytable set varchar_col = '';

the following leads to the same result

Update mytable set varchar_col = NULL;

But to select the columns where the value is empty or NULL, you have to use

select * from mytable where varchar_col is NULL;

Using

select * from mytable where varchar_col = '';

is syntactically correct, but it never returns a row.

On the other side, when concatenating strings in Oracle. NULL varchars are treated as empty strings.

select NULL || 'abc' from DUAL;

yields abc. Other DBMS would return NULL in these cases.

When you want to express explicitly, that a value is assigned, you have to use something like ' '.

And you have to worry whether trimming not empty results in NULL

select case when ltrim(' ') is null then 'null' else 'not null' end from dual

It does.

Now looking at DBMS where '' is not identical to NULL (e.g. SQL-Server)

Working with '' is generally easier and in most case there is no practical need to distinguish between both. One of the exceptions I know, is when your column represents some setting and you have not empty defaults for them. When you can distinguish between '' and NULL you are able to express that your setting is empty and avoid that the default applies.

๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ forums โ€บ topic โ€บ check-the-variable-is-empty-or-null
Check the Variable is Empty or Null โ€“ SQLServerCentral Forums
September 9, 2014 - Unfortunately there is no way of distinguishing between an unknown value or a missing value in standard sql, hence the NULL. ... Please don't do this... It's one of the things that drove me crazy with c programmers - the incessant urge to use side-effects as functionality.
๐ŸŒ
Quora
quora.com โ€บ What-are-the-differences-between-null-zero-and-blank-in-SQL
What are the differences between null, zero, and blank in SQL? - Quora
Answer (1 of 3): Itโ€™s important to know the difference between null, zero, and blank in SQL because they each represent something different. Take it from me, using these values incorrectly or choosing the wrong one can have enormous ramifications on the operation of your database and ...
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ sql server โ€บ how-to-check-a-column-is-empty-or-null-in-sql-server
How to Check a Column is Empty or Null in SQL Server - GeeksforGeeks
January 31, 2024 - There are many methods or functions to identify the NULL or Empty values. Below are some of them: ... Explained below with examples, the above five methods. Below is the Table 'StudentsInfo' with data used for the examples in this article: ... This key word returns any records with NULL value in the column specified in a Table.
๐ŸŒ
Blogger
javarevisited.blogspot.com โ€บ 2015 โ€บ 10 โ€บ how-to-replace-null-with-empty-string-in-SQL-SERVER-isnull-collesce-example.html
How to replace NULL with Empty String in SQL Server? ISNULL() vs COALESCE() Examples
October 3, 2024 - Here is our SQL query: SELECT first_name, last_name, first_name + last_name AS full_name FROM #People first_name last_name full_name Joe Root JoeRoot Mary NULL NULL NULL Broad NULL You can see that full_name is NULL for the second and third record because for them either first_name or last_name is NULL. In order to avoid that and to replace the NULL with empty String, let's use ISNULL() method in our SQL query:
๐ŸŒ
Quora
quora.com โ€บ Is-null-or-empty-SQL
Is null or empty SQL? - Quora
Answer (1 of 2): NULL is an unknown value in a table column. For example, if you see NULL in a ZipCode Columnโ€ฆthat value is unknown. It might help if a zip code is a required data element to adjust the software so the field cannot be left blank.
๐ŸŒ
Quora
quora.com โ€บ What-is-the-standard-SQL-query-for-checking-null-or-empty-strings
What is the standard SQL query for checking null or empty strings? - Quora
Answer (1 of 2): In standard SQL, you can use the [code ]IS NULL[/code] predicate to check if a value is [code ]NULL[/code]. To check for empty strings, you can use the [code ]IS NULL[/code] predicate along with the [code ]LENGTH[/code] function ...