Mega Code Archive

 
Categories / MySQL / Table Index
 

MODIFY statement should specify the null and default value attributes explicitly

mysql> mysql> CREATE TABLE mytbl     -> (     ->     j INT,     ->     c CHAR(1)     -> ); Query OK, 0 rows affected (0.00 sec) mysql> mysql> mysql> ALTER TABLE mytbl MODIFY j BIGINT NOT NULL DEFAULT 100; Query OK, 0 rows affected (0.01 sec) Records: 0  Duplicates: 0  Warnings: 0 mysql> SHOW COLUMNS FROM mytbl LIKE 'j'; +-------+------------+------+-----+---------+-------+ | Field | Type       | Null | Key | Default | Extra | +-------+------------+------+-----+---------+-------+ | j     | bigint(20) | NO   |     | 100     |       | +-------+------------+------+-----+---------+-------+ 1 row in set (0.00 sec) mysql> mysql> drop table mytbl; Query OK, 0 rows affected (0.00 sec)