DEFAULT NULL
时间: 2024-02-10 12:49:01 浏览: 66
DEFAULT NULL is a clause that can be added to a column definition in a SQL CREATE TABLE statement to set the default value of the column to NULL. This means that if no value is explicitly assigned to the column during an INSERT operation, the column will automatically be assigned a value of NULL.
For example, consider the following SQL statement:
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(50) DEFAULT NULL,
age INT DEFAULT NULL
);
In this statement, the columns "name" and "age" are defined with a DEFAULT NULL clause. This means that if no value is specified for these columns during an INSERT operation, they will be automatically assigned a value of NULL.
Note that the DEFAULT NULL clause is optional and can be omitted. If no default value is specified for a column, it will also be assigned a value of NULL if no value is provided during an INSERT operation.
阅读全文