They are different. When you enclose something in single quotes, it becomes a string -- this is true of all keywords in SQL, including NULL.

When you use just NULL, it is the SQL keyword, and it is compatible with all types.

So, these are quite different:

insert into t (col1, col2)
    values ('2021-05-25 11:58:41.000', NULL);

and:

insert into t (col1, col2)
    values ('2021-05-25 11:58:41.000', 'NULL');

'NULL' is a string and only compatible with a string type. You should get a type-conversion error if the column is not a string.

The one caveat is if you are storing the values in a text file for loading into the database. In such a file, strings may or may not be delimited with single quotes, depending on the structure of the file.

Answer from Gordon Linoff on Stack Overflow
Discussions

Insert NULL instead of blank if form fields left empty
Use prepared statements. More on reddit.com
🌐 r/PHPhelp
21
3
July 14, 2021
Insert data into the column which is having null values.
Hi, I have a column called "Classification_CD" .This column is having NULL values.I want to insert the data into this column. I tried to write the query as follows. But it is showing the me... More on forums.oracle.com
🌐 forums.oracle.com
February 16, 2011
MSSQLServerDatabase ExecuteSQL insert NULL values
When inserting a record into an MS SQL Server database, I check if the controls contain any data or not. If not, I would like to insert NULL values into the related columns in the database. For example, if WebTextField = “”, then insert NULL literal into the database. More on forum.xojo.com
🌐 forum.xojo.com
0
August 15, 2022
how to insert null instead of 0 for integer data type? - Forms - Scriptcase Low-code
Hi all, Im using scriptcase v8 and oracle as database. When creating a form, i will have items withe integer data type via front end (number in oracle back end). but there are occasions where i don’t need this field to be filled yet. i would just like to submit the form and make the field null. More on forum.scriptcase.net
🌐 forum.scriptcase.net
7
0
September 3, 2014
🌐
Tutorialspoint
tutorialspoint.com › sql › sql-null-values.htm
SQL - NULL Values
Here, NOT NULL signifies that column should always accept an explicit value of the given data type. You can insert NULL values into the columns where we did not use NOT NULL. Let us create a table with the name CUSTOMERS in the SQL database using the CREATE statement as shown in the query below −
🌐
Reddit
reddit.com › r/phphelp › insert null instead of blank if form fields left empty
r/PHPhelp on Reddit: Insert NULL instead of blank if form fields left empty
July 14, 2021 -

I am trying to insert my form data into mysql table there are two required fields and others can be left empty but the problem is the empty fields are inserting blank in sql table instead of NULL value. How do i do this? Here is pastebin code link

🌐
w3resource
w3resource.com › sql › insert-statement › insert-null.php
Sql inserting NULL values - w3resource
April 30, 2024 - -- INSERT INTO statement begins INSERT INTO agents -- Specifies the table 'agents' where the data will be inserted VALUES ("A001","Jodi","London",.12,NULL); -- Specifies the values to be inserted into each column of the table: -- "A001" will be inserted into the 'agent_code' column (assuming it's a string data type) -- "Jodi" will be inserted into the 'agent_name' column -- "London" will be inserted into the 'working_area' column -- .12 will be inserted into the 'commission' column (assuming it's a numeric data type) -- NULL will be inserted into the 'salary' column, assuming it allows NULL values ... This SQL code attempts to perform an INSERT operation into the 'agents' table.
🌐
W3Schools
w3schools.com › sql › sql_insert.asp
SQL INSERT INTO Statement
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 DATABASE DROP DEFAULT DROP INDEX DROP TABLE DROP VIEW EXEC EXISTS FOREIGN KEY FROM FULL OUTER JOIN GROUP BY HAVING IN INDEX INNER JOIN INSERT INTO INSERT INTO SELECT IS NULL IS NOT NULL JOIN LEFT JOIN LIKE LIMIT NOT NOT NULL OR ORDER BY OUTER JOIN PRIMARY KEY PROCEDURE RIGHT JOIN ROWNUM SELECT SELECT DISTINCT SELECT INTO SELECT TOP SET TABLE TOP TRUNCATE TABLE UNION UNION ALL UNIQUE UPDATE VALUES VIEW WHERE MySQL Functions
🌐
SQL Shack
sqlshack.com › working-with-sql-null-values
Working with SQL NULL values
May 19, 2021 - This article will explain what problems can occur when working with SQL NULL values ​​and it also gives some solution recommendations to overcome these issues. In terms of the relational database model, a NULL value indicates an unknown value. If we widen this theoretical explanation, the ...
Find elsewhere
🌐
Oracle
forums.oracle.com › ords › apexds › post › insert-data-into-the-column-which-is-having-null-values-2452
Insert data into the column which is having null values.
February 16, 2011 - Hi, I have a column called "Classification_CD" .This column is having NULL values.I want to insert the data into this column. I tried to write the query as follows. But it is showing the me...
🌐
GeeksforGeeks
geeksforgeeks.org › sql › how-to-insert-rows-with-null-values-in-sql
How to Insert Rows with NULL Values in SQL? - GeeksforGeeks
July 23, 2025 - In SQL, due to lack of data, we sometimes need to insert rows with NULL values in the tables. Here, the keyword NULL(without quotes) is used to represent no data.
🌐
Rocket Software
docs.rocketsoftware.com › bundle › unidatausingsql_ug_824 › page › tbe1685022307385.html
Inserting empty strings and the null value
Skip to main contentSkip to search · Powered by Zoomin Software. For more details please contactZoomin · Log in to get a better experience · Login · Rocket Software · 77 4th Avenue Waltham, MA 02451 USA · Products · About · Contact · Resources
🌐
W3Schools
w3schools.com › sql › sql_isnull.asp
W3Schools.com
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST · SQL HOME SQL Intro SQL Syntax SQL Select SQL Select Distinct SQL Where SQL Order By SQL And SQL Or SQL Not SQL Insert Into SQL Null Values SQL Update SQL Delete SQL Select Top SQL Aggregate Functions SQL Min and Max SQL Count SQL Sum SQL Avg SQL Like SQL Wildcards SQL In SQL Between SQL Aliases SQL Joins SQL Inner Join SQL Left Join SQL Right Join SQL Full Join SQL Self Join SQL Union SQL Union All SQL Group By SQL Having SQL Exists SQL Any, All SQL Select Into SQL Insert Into Select SQL Case SQL Null Functions SQL Stored Procedures SQL Comments SQL Operators
🌐
Xojo Programming Forum
forum.xojo.com › targets › web
MSSQLServerDatabase ExecuteSQL insert NULL values - Web - Xojo Programming Forum
August 15, 2022 - When inserting a record into an MS SQL Server database, I check if the controls contain any data or not. If not, I would like to insert NULL values into the related columns in the database. For example, if WebTextField = “”, then insert NULL literal into the database.
🌐
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
To test for null values in a query, use IS NULL or IS NOT NULL in the WHERE clause. You can insert null values into a column by explicitly stating NULL in an INSERT or UPDATE statement, or by leaving a column out of an INSERT statement.
🌐
Quora
quora.com › How-do-you-add-null-values-in-SQL
How to add null values in SQL - Quora
Answer (1 of 3): NULL values are handled differently depending on whether they are in the context of a tuple or a set. In the case of a tuple: (e.g. 1 + NULL), the result is always NULL. This is because if any part of a tuple is missing or unknown then the entire tuple cannot be known and hence m...
🌐
Scriptcase
forum.scriptcase.net › applications › forms
how to insert null instead of 0 for integer data type? - Forms - Scriptcase Low-code
September 3, 2014 - Hi all, Im using scriptcase v8 and oracle as database. When creating a form, i will have items withe integer data type via front end (number in oracle back end). but there are occasions where i don’t need this field to be filled yet. i would just like to submit the form and make the field null.
🌐
Tech Nexus
tdev.umb.edu › view › post › sql-how-to-insert-a-null-value
sql how to insert a null value
September 5, 2024 - This article will guide you through the steps and methods of inserting null values into your database tables. A null value in SQL represents the absence of a value or a placeholder where no data exists. It is important to differentiate between a null value and an empty string ('') or a number like 0.
🌐
Iamtimcorey
blog.iamtimcorey.com › im-getting-a-cannot-insert-the-value-null-into-column-id-message-in-sql
I’m Getting a Cannot Insert the Value NULL Into Column ‘ID’ Message in SQL – IAmTimCorey Blog
You look at your SQL statement first, to see if that is the issue. Here is what mine looks like: Pretty simple, right? Now if you look at the table, you see the following: OK, so there is the Id column that it says is the problem but it is the primary key and an int. Doesn’t that mean it will automatically count up as we insert records? Hint: nope. Now that we know the issue, let’s discuss the options. Your first instinct might be to try to insert an Id in the Id column manually.
🌐
Scaler
scaler.com › topics › sql › null-value-in-sql
NULL Value in SQL - Scaler Topics
March 28, 2024 - NULL can be inserted in any column by using the assignment operator "=". Also, to test whether a NULL is present or not we have to use certain operators, for example, IS NULL and IS NOT NULL.
🌐
GeeksforGeeks
geeksforgeeks.org › sql › how-to-set-a-column-value-to-null-in-sql
How to Set a Column Value to Null in SQL? - GeeksforGeeks
NULL: It represents the NULL value in SQL. WHERE: This statement has an optional part that specifies which rows should be updated. column_name: The name of the column you want to update should be replaced here. Firstly, let's create a table using the CREATE TABLE command: -- create a table CREATE TABLE students (Sr_No integer,Name varchar(20), Gender varchar(2)); -- insert some values INSERT INTO students VALUES (1, 'Nikita', 'F'); INSERT INTO students VALUES (2, 'Akshit', 'M'); INSERT INTO students VALUES (3, 'Ritesh', 'F'); INSERT INTO students VALUES (4, 'Himani', 'F'); -- fetch some values SELECT * FROM students ;
Published   July 23, 2025
🌐
SQLServerCentral
sqlservercentral.com › forums › topic › insert-null-values-into-a-not-null-column
Insert Null values into a Not null column – SQLServerCentral Forums
July 18, 2012 - Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/ Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/ Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/ Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/ ... yes forget the trigger idea that was daft. I think the check constraint meets the requirement however. Rows with an ID < 200 can have a null created date · Rows with an ID >200 can;t have a null created date. The default constraint stops the existing stored procs from breaking. ... Thanks. The second one works for me. ... You must be logged in to reply to this topic.