MODIFY 修改

  1. MODIFY 改變資料表 tbl 欄位 c 的格式由原固定 1 個字元改為 10 個字元。
    MariaDB root@(none):dyw> alter table tbl modify c char(10);
    You're about to run a destructive command.
    Do you want to proceed? (y/n): y
    Your call!
    Query OK, 4 rows affected
    Time: 0.124s
    
  2. 再查看資料表 tbl 的欄位格式。
    MariaDB root@(none):dyw> desc tbl;
    +-----------------+--------------+------+-----+---------+----------------+
    | Field           | Type         | Null | Key | Default | Extra          |
    +-----------------+--------------+------+-----+---------+----------------+
    | ti              | tinyint(4)   | YES  |     | <null>  |                |
    | id              | int(11)      | NO   | PRI | <null>  | auto_increment |
    | c               | char(10)     | YES  |     | <null>  |                |
    | title           | varchar(100) | NO   |     | <null>  |                |
    | author          | varchar(40)  | NO   |     | <null>  |                |
    | submission_date | date         | YES  |     | <null>  |                |
    +-----------------+--------------+------+-----+---------+----------------+
    
    6 rows in set
    Time: 0.026s