๐ŸŒ
W3Schools
w3schools.com โ€บ sql โ€บ sql_null_values.asp
SQL NULL Values - IS NULL and IS NOT NULL
If a field in a table is optional, ... field will be saved with a NULL value. A NULL value represents an unknown, missing, or inapplicable data in a database field....
special marker and keyword in SQL indicating that something has no value
Null (SQL) - Wikipedia
NULL is a special marker used to indicate that a data value does not exist in the database. Introduced by the creator of the relational database model, E. F. Codd, SQL null โ€ฆ Wikipedia
Factsheet
Null (SQL)
Notation ฯ‰
Factsheet
Null (SQL)
Notation ฯ‰
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ Null_(SQL)
Null (SQL) - Wikipedia
January 7, 2026 - NULL is a special marker used to indicate that a data value does not exist in the database. Introduced by the creator of the relational database model, E. F. Codd, SQL null serves to fulfill the requirement that all true relational database management systems (RDBMS) support a representation ...
Discussions

Need some knowledge on NULL and NOT NULL
a null is used for multiple purposes -- for example, not known, not applicable, etc. theoreticians take great joy in debating which uses are valid, and whether they can be substituted by some non-null placeholder suffice to say, a null is used when you don't know what value should go there if you don't want that situation to arise, just make the column NOT NULL and you'll never be able to not insert an actual value More on reddit.com
๐ŸŒ r/SQL
32
14
December 22, 2021
What is NULL in SQL? - Stack Overflow
NULL is a value used to indicate that there is no domain specific value in the field. But I would still say that NULL itself is a value. Just try to ask a database admin what the default value is of a field, if no value is provided. More on stackoverflow.com
๐ŸŒ stackoverflow.com
oop - Are nulls in a relational database okay? - Stack Overflow
There's a school of thought that null values should not be allowed in a relational database. That is, a table's attribute (column) should not allow null values. Coming from a software development More on stackoverflow.com
๐ŸŒ stackoverflow.com
feature comparison - When to use NULL and when to use an empty string? - Database Administrators Stack Exchange
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! More on dba.stackexchange.com
๐ŸŒ dba.stackexchange.com
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ sql โ€บ sql-null-values
NULL values in SQL - GeeksforGeeks
January 5, 2026 - To handle such scenarios, SQL provides ... a NULL value differs from a zero or an empty string. A NULL value represents missing or undefined data....
๐ŸŒ
Microsoft Learn
learn.microsoft.com โ€บ en-us โ€บ dotnet โ€บ framework โ€บ data โ€บ adonet โ€บ sql โ€บ handling-null-values
Handling Null Values - ADO.NET | Microsoft Learn
September 15, 2021 - A null value in a relational database is used when the value in a column is unknown or missing. A null is neither an empty string (for character or datetime data types) nor a zero value (for numeric data types).
๐ŸŒ
Tencent Cloud
tencentcloud.com โ€บ techpedia โ€บ 133696
What does null value mean in a database? - Tencent Cloud
December 31, 2025 - In a database, a null value represents the absence of a value or an unknown value in a column of a table. It is not the same as zero (0), an empty string (''), or a space (' '). Instead, it indicates ...
๐ŸŒ
Reddit
reddit.com โ€บ r/sql โ€บ need some knowledge on null and not null
r/SQL on Reddit: Need some knowledge on NULL and NOT NULL
December 22, 2021 -
  • Where and why exactly a null is used?

  • What is exactly null and not null? To my understanding Not null we use when its mandatory to insert some value in that field, also when we give check constraint so by default the column will be not null right?

  • By adding new column through alter method default values are null, so how would I be able to insert values in it and is it right to give not null constraint to that new column while adding through alter method, basically when null and when not null to be used?...

god this is so confusing please help me, ik im asking alot but im really confused

Top answer
1 of 5
3

In simple worlds you can say that Null is not a data value, but a marker for an unknown value.

So any mathematical operations performed on NULL will result in NULL. For example,

10 + NULL = NULL

Similarly if you do string concatenation with string you get:-

'String ' || NULL || 'Concatenation'   -- Result is NULL

So you can say that Null means either "not applicable" or "don't know": it is not the same as zero (0) or any other default value, but more importantly, null is treated quite differently from other values in SQL, because it literally has no value.

An example to explain what it means when we say that NULL means UNKNOWN VALUE:

StudentName TestResult
X             78
A             89
B             67
C             NULL

So you can see that the student C got NULL marks in the test. So what does that mean?

Now one can say that the student does not sit in the test or it may be that the student's data is not avaialable. But it definitely does not mean that the student got 0(as if you assign 0 to the student then it would mean that the student appeared in the test and got zero) marks in the test. All we can say that the data for the student is

UNKNOWN or NULL

2 of 5
2

A field with a NULL value is a field with no value. It is very important to understand that a NULL value is different than a zero value or a field that contains spaces.

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. This means that the field will be saved with a NULL value.

NULL values are treated differently from other values.

NULL is used as a placeholder for unknown or inapplicable values. Read more about this here.

Find elsewhere
๐ŸŒ
Khoury College of Computer Sciences
khoury.northeastern.edu โ€บ home โ€บ kenb โ€บ MeaningOfNull.html
The Meaning of Null in Databases and Programming Languages
The main distinction between the relational null and the programming language null is the following: The relational null represents the absence of a value in a field of a record; whereas the programming language null represents one of the possible values of a variable. Succinctly, Consequently, the phrase "null value" is an oxymoron for databases.
๐ŸŒ
DbSchema
dbschema.com โ€บ blog โ€บ tutorials โ€บ sql-null-values
SQL NULL Values Explained with Examples
In SQL, NULL is a special marker used to indicate that a data value does not exist in the database. It is important to note that NULL is not the same as an empty string or a zero value.
๐ŸŒ
Navicat
navicat.com โ€บ en โ€บ company โ€บ aboutus โ€บ blog โ€บ 1312-the-null-value-and-its-purpose-in-relational-database-systems.html
The NULL Value and its Purpose in Relational Database Systems
In that sense, NULL does not refer to a memory location, as it does for programming languages. In a database, the NULL value indicates a lack of a value, which is not the same thing as a value of zero. To illustrate, consider the question "How ...
๐ŸŒ
Biztory
biztory.com โ€บ blog โ€บ 2019 โ€บ 07 โ€บ 22 โ€บ null-values-tips
7 Things You Should Know About NULL Values - Biztory
October 25, 2025 - A NULL value is a special marker used in SQL to indicate that a data value does not exist in the database. In other words, it is just a placeholder to denote values that are missing or that we do not know.
๐ŸŒ
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
November 18, 2025 - No two null values are equal. Comparisons between two null values, or between a null value and any other value, return unknown because the value of each NULL is unknown. Null values generally indicate data that is unknown, not applicable, or to be added later.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ home โ€บ sql โ€บ sql null values
Understanding SQL NULL Values
November 29, 2009 - SQL uses the term NULL to represent a non-existent data value in the database. These values are not the same as an empty string or a zero. They don't hold any space in the database and are used to signify the absence of a value or the unknown ...
๐ŸŒ
DB Vis
dbvis.com โ€บ thetable โ€บ working-with-null-in-databases-turn-your-frustration-into-delight
Working with NULL in Databases: Turn Frustration Into Delight
July 5, 2024 - Many database administrators set NULL as the default value of their columns when creating a table by running a query like so: Assigning the default value of columns in DbVisualizer ยท Now when any data is inserted into the column named column_1, the default โ€“ โ€œpre-builtโ€ if you will โ€“ value will be NULL.
๐ŸŒ
iNTERFACEWARE
help.interfaceware.com โ€บ v6 โ€บ dealing-with-null-data-from-databases
Dealing with NULL data from databases - iNTERFACEWARE Help Center
We often deal with issues caused by NULL database values. The most common one is are NULL and BLANK (empty) strings the same or different? The theoretical answer is different. But in reality they can be treated differently on different systems. Fortunately Iguana is flexible and can accommodate ...
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.

Top answer
1 of 7
40

It's convenient for the way SQL is typically used. Consider this statements:

SELECT people.name, cars.model FROM people
INNER JOIN cars
    ON people.car_licenceplate = cars.licenceplate

If null = null, then this would return all pairs of people with no license plate with all unregistered cars in the database, a usually undesirable result.

It's particularly convenient that, even if you use any null value even in a more complex expression, you won't get a value back, even if other values may also happen to be null. In other languages you'd need to null check everything in advance to get that behavior, having it by default is very convenient for the type of things SQL is typically used for.

null in SQL is exempt from a lot of other rules too. For example they are excluded from unique constraints. All indicating it represents more the absence of a value rather than a special value.

Some other languages do also have a ThreeValueBoolean or a similar type that behaves more like a SQL null, though only for booleans. Also most every language has similar non self-equality for NaN. It's not a concept unique to SQL.

2 of 7
23

One way to look at this is to compare these two questions:

  1. Is value A definitely the same as value B?
  2. Is value A definitely different from value B?

On the face of it, these are symmetrical: if question 1 is true, question 2 is false, and vice versa.

But what if both A and B are missing or invalid data points?

  1. False. We can't know for sure that the two missing or invalid data points are the same.
  2. False. We can't know for sure that the two missing or invalid data points are different.

That puts us in a peculiar position: A = B and A <> B should both be false, but that means that NOT (A = B) is no longer the same as A <> B, which is surprising.

SQL handles this by returning a further NULL - if the data for A and B is missing, then the information about whether they are the same or different is also missing. This is consistent with other operations on NULL, e.g. NULL + NULL is NULL, because adding two unknown numbers gives you a third unknown number. And since that also includes boolean negation - if A is NULL, then NOT A is also NULL, the result of NOT (A = B) is always the same as A <> B, as we'd intuitively expect.

However, there are situations where we want to ask the strict negation of those questions:

  1. Is value A not definitely the same as value B? (Strict inverse of question 1)
  2. Is value A not definitely different from value B? (Strict inverse of question 2)

For these, SQL provides the DISTINCT FROM and NOT DISTINCT FROM operators.

More commonly, you want to know explicitly that a particular value is or is not null, for which there are the operators IS NULL and IS NOT NULL.

๐ŸŒ
Quora
quora.com โ€บ What-is-the-difference-between-the-value-NULL-in-different-SQL-databases
What is the difference between the value 'NULL' in different SQL databases? - Quora
Answer: It's important to note, that NULL doesn't equal NULL. NULL is not a value, and therefore cannot be compared to another value. where x is null checks whether x is a null value. Null is a value, it's just unknown value.
๐ŸŒ
Oracle
docs.oracle.com โ€บ en โ€บ database โ€บ oracle โ€บ oracle-database โ€บ 26 โ€บ sqlrf โ€บ Nulls.html
Nulls
4 days ago - Nulls can appear in columns of any data type that are not restricted by NOT NULL or PRIMARY KEY integrity constraints. Use a null when the actual value is not known or when a value would not be meaningful. The database treats a character value with a length of zero as null.