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

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
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
Check the Variable is Empty or Null โ€“ SQLServerCentral Forums
Perhaps internally SQL Server treats ISNULL() like any other scalar function, so it prevents the optimiser from being really efficient and has to do more stuff separately for each row. Sure, but I still prefer a single check. Note that the code should include the comments to keep clarity on what it is doing. WHERE MyNullableCol != '' --This will avoid NULLs and empty ... More on sqlservercentral.com
๐ŸŒ sqlservercentral.com
September 9, 2014
Sql Connector - Write NULL intead of empty in SQL Database
But when I have a input value is not filled, then the information stored on the database is empty, and I would like to keep it as NULL. I tried to manage it in the SQL command and add a test IF @variable IS โ€˜โ€™ then @variable = NULL which is working for one or two line, but not possible ... More on forum.bubble.io
๐ŸŒ forum.bubble.io
1
0
October 5, 2022
๐ŸŒ
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
93

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.

๐ŸŒ
DevArt
blog.devart.com โ€บ home โ€บ how to โ€บ how to handle null or empty values in sql server
How to Handle Null or Empty Values in SQL Server
December 19, 2024 - This article explores the differences between NULLs and empty values in SQL Server and discusses how to handle them effectively. ... NULL represents missing or unknown data in a database column. This can occur in two scenarios: when the data ...
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_ref_is_null.asp
SQL IS NULL
The IS NULL command is used to test for empty values (NULL values). The following SQL lists all customers with a NULL value in the "Address" field: SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NULL; Try it Yourself ...
๐ŸŒ
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.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ language-elements โ€บ null-and-unknown-transact-sql
NULL and UNKNOWN (Transact-SQL) - SQL Server | Microsoft Learn
... Applies to: SQL Server Azure ... Fabric Warehouse in Microsoft Fabric SQL database in Microsoft Fabric ยท NULL indicates that the value is unknown....
๐ŸŒ
SQLServerCentral
sqlservercentral.com โ€บ forums โ€บ topic โ€บ check-the-variable-is-empty-or-null โ€บ page โ€บ 3
Check the Variable is Empty or Null โ€“ SQLServerCentral Forums
September 9, 2014 - Perhaps internally SQL Server treats ISNULL() like any other scalar function, so it prevents the optimiser from being really efficient and has to do more stuff separately for each row. Sure, but I still prefer a single check. Note that the code should include the comments to keep clarity on what it is doing. WHERE MyNullableCol != '' --This will avoid NULLs and empty ...
๐ŸŒ
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.
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ sql โ€บ t-sql โ€บ queries โ€บ is-null-transact-sql
IS NULL (Transact-SQL) - SQL Server | Microsoft Learn
To determine whether an expression is NULL, use IS NULL or IS NOT NULL instead of comparison operators (such as = or !=). Comparison operators return UNKNOWN when either or both arguments are NULL.
๐ŸŒ
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
In standard SQL, you can use the IS NULL predicate to check if a value is NULL. To check for empty strings, you can use the IS NULL predicate along with the LENGTH function (or its equivalent for your database system) to check if the length ...
๐ŸŒ
ThoughtSpot
thoughtspot.com โ€บ sql-tutorial โ€บ sql-is-null
SQL IS NULL | Basic SQL | ThoughtSpot
March 12, 2026 - This SQL tutorial covers how to work with null values by using SQL's IS NULL operator to select rows where a column contains no data.
๐ŸŒ
Hightouch
hightouch.com โ€บ sql-dictionary โ€บ sql-is-null
SQL IS NULL - Syntax, Use Cases, and Examples | Hightouch
December 29, 2023 - Ensuring data quality and integrity by identifying incomplete records. The SQL IS NULL operator is a standard SQL feature and is available in most relational database management systems (RDBMS) that support SQL.
๐ŸŒ
Bubble
forum.bubble.io โ€บ need help โ€บ plugins
Sql Connector - Write NULL intead of empty in SQL Database - Plugins - Bubble Forum
October 5, 2022 - But when I have a input value is not filled, then the information stored on the database is empty, and I would like to keep it as NULL. I tried to manage it in the SQL command and add a test IF @variable IS โ€˜โ€™ then @variable = NULL which is working for one or two line, but not possible ...