CHANGE 改變

  1. CHANGE 同時改變資料表 tbl 欄位 ti 的名稱及格式,由原 ti 格式 TINYINT 改成 bi 格式 bigint。
    MariaDB root@(none):dyw> alter table tbl change ti bi bigint;
    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.087s
    
  2. 再查看資料表 tbl 的欄位格式。
    MariaDB root@(none):dyw> desc tbl;
    +-----------------+--------------+------+-----+---------+----------------+
    | Field           | Type         | Null | Key | Default | Extra          |
    +-----------------+--------------+------+-----+---------+----------------+
    | bi              | bigint(20)   | 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.025s