Managing tables

A statement that renames a table

ALTER TABLE products RENAME TO product;

A statement that adds a new column at the end of the table

ALTER TABLE customers ADD lastTransactionDate DATE;

A statement that adds a new column after a specified column

ALTER TABLE customers ADD lastTransactionDate DATE AFTER emailAddress;

A statement that drops a column

ALTER TABLE customers DROP lastTransactionDate;

A statement that renames a column

ALTER TABLE customers CHANGE emailAddress email VARCHAR(255) NOT NULL UNIQUE;

Back