codegurukool.com · Free coding tutorials & online compiler

Home › SQL Tutorial › SQL INSERT INTO and NULL

SQL INSERT INTO and NULL

Add rows and handle missing values.

INSERT INTO adds a row. A column you skip gets NULL, meaning no value. You cannot test NULL with =; use IS NULL or IS NOT NULL.

Example code

INSERT INTO Customers (id, name, country)
VALUES (6, 'Fay', 'UK');

SELECT name, city FROM Customers
WHERE city IS NULL;

Run this code in the online editor

← SQL AND, OR, NOTSQL UPDATE →