DEFAULT is the value that will be inserted if there is no explicit value in the insert / update statement. Suppose your DDL did not have a NOT NULL :
ALTER TABLE tbl ADD COLUMN col VARCHAR(20) DEFAULT "MyDefault"
Then you could issue these statements
-- 1. This will insert "MyDefault" into tbl.col INSERT INTO tbl (A, B) VALUES (NULL, NULL); -- 2. This will insert "MyDefault" into tbl.col INSERT INTO tbl (A, B, col) VALUES (NULL, NULL, DEFAULT); -- 3. This will insert "MyDefault" into tbl.col INSERT INTO tbl (A, B, col) DEFAULT VALUES; -- 4. This will insert NULL into tbl.col INSERT INTO tbl (A, B, col) VALUES (NULL, NULL, NULL);
Alternatively, you can also use DEFAULT in UPDATE in accordance with the SQL-1992 standard:
-- 5. This will update "MyDefault" into tbl.col UPDATE tbl SET col = DEFAULT; -- 6. This will update NULL into tbl.col UPDATE tbl SET col = NULL;
Note that not all databases support all of these standard SQL syntaxes. Adding a NOT NULL will result in an error with operators 4, 6 , while 1-3, 5 are still valid operators. So, to answer your question: no, they are not redundant.
Lukas Eder Aug 08 2018-12-12T00: 00Z
source share