Altering a Table
The ALTER TABLE
command is used to alter a table.
Columns can be added or removed after a table is created.
Adding a Column
Syntax
ALTER TABLE <table-name> ADD <column-name> <column-constraints>;
Example
ALTER TABLE Companies
ADD stock_symbol VARCHAR(5) UNIQUE,
ADD stock_price REAL;
Removing a Column
Syntax
ALTER TABLE <table-name> DROP <column-name>;
Example
ALTER TABLE Companies
DROP stock_symbol,
DROP stock_price;