MySQL Add Column: ALTER TABLE Methods
There are several methods for adding a column in MySQL.
- Use the ALTER TABLE statement.
ALTER TABLE table_name
ADD column_name column_definition;
- Using the MODIFY COLUMN statement:
ALTER TABLE table_name
MODIFY COLUMN column_name column_definition;
- Modify the column using the CHANGE COLUMN statement:
ALTER TABLE table_name
CHANGE COLUMN old_column_name new_column_name column_definition;
It is important to note that when using the above methods, you need to replace the corresponding table_name, column_name, and column_definition with the actual table name, column name, and column definition.