SQL Column definition : default value and not null redundant?
问题 I've seen many times the following syntax which defines a column in a create/alter DDL statement: ALTER TABLE tbl ADD COLUMN col VARCHAR(20) NOT NULL DEFAULT "MyDefault" The question is: since a default value is specified, is it necessary to also specify that the column should not accept NULLs ? In other words, doesn't DEFAULT render NOT NULL redundant ? 回答1: DEFAULT is the value that will be inserted in the absence of an explicit value in an insert / update statement. Lets assume, your DDL