Skip to content

NULL

CREATE TABLE Employees (
EmployeeID INT,
FirstName VARCHAR(30),
LastName VARCHAR(30),
Address VARCHAR(60) NULL
);
INSERT INTO Employees (EmployeeID, FirstName, LastName)
VALUES (1, 'John', 'Doe');
SELECT * FROM Employees;
+------------+-----------+----------+---------+
| EmployeeID | FirstName | LastName | Address |
+------------+-----------+----------+---------+
| 1 | John | Doe | NULL |
+------------+-----------+----------+---------+

This example demonstrates the usage of NULL in MySQL. A new table “Employees” is created with a nullable “Address” column. An employee is added without an address, so when selecting all records from the table, the address for this employee is shown as NULL, signifying that no value has been assigned.