next up previous contents
Next: SET DEFAULT 設定預設值 Up: ALTER 語法 Previous: CHANGE 改變   Contents   DYWANG_HOME

DROP 刪除

  1. DROP 刪除資料表 tbl 欄位 c。
    mariadb root@localhost:dyw> alter table tbl drop c;                             
    You're about to run a destructive command.
    Do you want to proceed? (y/n): y
    Your call!
    Query OK, 0 rows affected
    Time: 0.116s
    
  2. 再查看資料表 tbl 的欄位格式。
    mariadb root@localhost:dyw> show columns from tbl;                              
    +-----------------+--------------+------+-----+---------+----------------+
    | Field           | Type         | Null | Key | Default | Extra          |
    +-----------------+--------------+------+-----+---------+----------------+
    | bi              | bigint(20)   | YES  |     | <null>  |                |
    | id              | int(11)      | NO   | PRI | <null>  | auto_increment |
    | title           | varchar(100) | NO   |     | <null>  |                |
    | author          | varchar(40)  | NO   |     | <null>  |                |
    | submission_date | date         | YES  |     | <null>  |                |
    +-----------------+--------------+------+-----+---------+----------------+
    
    5 rows in set
    Time: 0.026s
    



De-Yu Wang 2020-04-07