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!

Answer from Larry Coleman on Stack Exchange
๐ŸŒ
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)....
๐ŸŒ
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)....
๐ŸŒ
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 โ€บ 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
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_ref_is_not_null.asp
SQL IS NOT NULL
The IS NOT NULL command is used to test for non-empty values (NOT NULL values). The following SQL lists all customers with a value in the "Address" field: SELECT CustomerName, ContactName, Address FROM Customers WHERE Address IS NOT NULL; Try it Yourself ยป ... If you want to use W3Schools services as an educational institution, team or ...
๐ŸŒ
W3Schools
www-db.deis.unibo.it โ€บ courses โ€บ TW โ€บ DOCS โ€บ w3schools โ€บ sql โ€บ sql_null_values.asp.html
SQL NULL Values - IS NULL and IS NOT NULL
NULL values represent missing unknown data. By default, a table column can hold NULL values. This chapter will explain the IS NULL and IS NOT NULL operators. If a column in a table is optional, we can insert a new record or update an existing record without adding a value to this column.
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.

๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ func_sqlserver_isnull.asp
SQL Server ISNULL() Function
The ISNULL() function returns a specified value if the expression is NULL. If the expression is NOT NULL, this function returns the expression. ... If you want to use W3Schools services as an educational institution, team or enterprise, send ...
Find elsewhere
๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_notnull.asp
SQL NOT NULL Constraint
To create a NOT NULL constraint on the "Age" column when the "Persons" table is already created, use the following SQL: ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]
๐ŸŒ
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 - SELECT id, name FROM Department WHERE code IS NULL OR TRIM(code) = ''; The TRIM function removes whitespaces from a stringโ€™s beginning and end, allowing us to compare it against an empty character. ... The COALESCE function in SQL returns the first non-NULL value from a list of arguments.
๐ŸŒ
W3Schools
w3schools.com โ€บ mysql โ€บ func_mysql_ifnull.asp
MySQL IFNULL() Function
If the expression is NOT NULL, this function returns the expression. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected] ยท If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected] ยท HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
๐ŸŒ
Coginiti
coginiti.co โ€บ home โ€บ beginner โ€บ sql is null
What is the IS NULL Operator in SQL? - Coginiti
September 25, 2023 - #+src sql FindNulls(table, columns) #+meta { :doc "Find records where specified columns are NULL in a given table." } #+begin SELECT * FROM {{ table }} WHERE #+for col : columns separator " OR " do {{ col }} IS NULL #+end #+end ยท SELECT * FROM {{ FindNulls("employees", ["email", "phone_number"]) }}; SELECT * FROM {{ FindNulls("orders", ["shipping_address", "billing_address"]) }};
๐ŸŒ
W3Schools
w3schoolsua.github.io โ€บ sql โ€บ sql_null_values_en.html
SQL NULL Values. Examples. Lessons for beginners. W3Schools in English
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)....
๐ŸŒ
W3Schools
w3schools.com โ€บ mySQl โ€บ sql_ref_not_null.asp
SQL NOT NULL
The following SQL creates a NOT NULL constraint on the "Age" column when the "Persons" table is already created: ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]
๐ŸŒ
ThoughtSpot
thoughtspot.com โ€บ sql-tutorial โ€บ sql-is-null
SQL IS NULL | Basic SQL | ThoughtSpot
3 weeks ago - This is covered in greater detail in the intermediate tutorial, but for now, here's what you need to know: You can select rows that contain no data in a given column by using IS NULL.
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ Null_(SQL)
Null (SQL) - Wikipedia
1 week ago - Misunderstanding of how Null works is the cause of a great number of errors in SQL code, both in ISO standard SQL statements and in the specific SQL dialects supported by real-world database management systems. These mistakes are usually the result of confusion between Null and either 0 (zero) or an empty string (a string value with a length of zero, represented in SQL as '').
๐ŸŒ
Programiz
programiz.com โ€บ sql โ€บ is-null-not-null
SQL IS NULL and IS NOT NULL (With Examples)
IS NULL and NOT NULL in SQL are used to check if any field contains null values. In this tutorial, you will learn about the SQL IS NULL and NOT NULL with the help of examples.