Modify mysql table

Modify the column names need to add the type of final

ALTER TABLE book CHANGE COLUMN publishdate pubDate DATETIME;

Type column and constraint modification

ALTER TABLE book MODIFY COLUMN pubdate TIMESTAMP;

Add a new column to add Type

ALTER TABLE book ADD COLUMN annual DOUBLE;

Remove Columns

ALTER TABLE author DROP COLUMN annual;
ALTER TABLE author DROP COLUMN IF EXISTS annual;

Modify the table name

ALTER TABLE author RENAME TO book_author;

Delete table

DROP TABLE book_author;

View the table so the current library

SHOW TABLES;

Guess you like

Origin blog.51cto.com/14437184/2440122