Let’s take a look some examples of adding a new column to an existing table. To add two or more columns to a table at the same time, you use the following syntax: ALTER TABLE table ADD column_name_1 column_1_definition ,ĪDD column_name_2 column_2_definition ,Ĭode language: SQL (Structured Query Language) ( sql ) If you don’t explicitly specify the position of the new column, MySQL will add it as the last column. It also allows you to add the new column after an existing column using the AFTER existing_column clause. Third, MySQL allows you to add the new column as the first column of the table by specifying the FIRST keyword.
Note that COLUMN keyword is optional so you can omit it. Second, you put the new column and its definition after the ADD COLUMN clause.First, you specify the table name after the ALTER TABLE clause.Let’s examine the statement in more detail. To add a new column to an existing table, you use the ALTER TABLE ADD COLUMN statement as follows: ALTER TABLE table ADD column_name column_definition Code language: SQL (Structured Query Language) ( sql ) Introduction to MySQL ADD COLUMN statement Summary: in this tutorial, we will show you how to add a column to a table using MySQL ADD COLUMN statement.