> Do any databases support CREATE TABLE statement with fields > having a DEFAULT clause without a NOT NULL?
Oracle and MySQL do, at least. [EMAIL PROTECTED] src]$ sqlplus test/test SQL*Plus: Release 9.2.0.5.0 - Production on Mon Aug 30 00:13:29 2004 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. Connected to: Oracle9i Enterprise Edition Release 9.2.0.5.0 - Production With the Partitioning option JServer Release 9.2.0.5.0 - Production SQL> CREATE TABLE foo ( 2 bar INTEGER, 3 baz INTEGER DEFAULT 42 4 ) 5 / Table created. SQL> desc foo; Name Null? Type ----------------------------------------- -------- ---------------------------- BAR NUMBER(38) BAZ NUMBER(38) SQL> INSERT INTO foo (bar, baz) VALUES (1, NULL); 1 row created. SQL> INSERT INTO foo (bar) VALUES (1); 1 row created. SQL> commit; Commit complete. SQL> select * from foo; BAR BAZ ---------- ---------- 1 1 42 [EMAIL PROTECTED]:~$ mysql -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 6 to server version: 4.0.18-max Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> connect test; Connection id: 7 Current database: test mysql> CREATE TABLE foo ( -> bar INTEGER, -> baz INTEGER DEFAULT 42 -> ); Query OK, 0 rows affected (0.03 sec) mysql> INSERT INTO foo (bar, baz) VALUES (1, NULL); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO foo (bar) VALUES (1); Query OK, 1 row affected (0.01 sec) mysql> select * from foo; +------+------+ | bar | baz | +------+------+ | 1 | NULL | | 1 | 42 | +------+------+ 2 rows in set (0.00 sec) -- Andy Hassall <[EMAIL PROTECTED]> / Space: disk usage analysis tool <http://www.andyh.co.uk> / <http://www.andyhsoftware.co.uk/space>