Science, Tech, Math › Computer Science How to Add a Column to a MySQL Table Adding a Column in an Existing MySQL Table Share Flipboard Email Print Diane Diederich/E+/Getty Images Computer Science PHP Programming MySQL Commands Tutorials Perl Python Java Programming Javascript Programming Delphi Programming C & C++ Programming Ruby Programming Visual Basic View More By Angela Bradley Angela Bradley Computer Science Expert B.A, History, Eastern Oregon University Angela Bradley is a web designer and programming expert with over 15 years of experience. An expert in iOS software design and development, she specializes in building technical hybrid platforms. Learn about our Editorial Process Updated on May 23, 2018 The command add column is used to add an additional column to any given MySQL table. To do this, you must specify the column name and type. Note: The add column command is sometimes referred to as additional column or new column. How to Add a MySQL Column Adding a column to an existing table is done with this syntax: alter table add column [new column name] [type]; Here's an example: alter table icecream add column flavor varchar (20) ; What this example would end up doing is adding the column "flavor" to the table "icecream," just as it says above. It would be in the database "varchar (20)" format. Know, however, that the "column" clause is not required. So, you could instead use "add [new column name]...", like this: alter table icecream add flavor varchar (20) ; Adding a Column After an Existing Column Something you may prefer to do is add a column after a specified existing column. So, if you'd like to add the column flavor after one called size, you could do something like this: alter table icecream add column flavor varchar (20) after size; Changing a Column Name on a MySQL Table You can change a column's name with the alter table and change commands. Read more about that in the How to Change a Column Name in MySQL tutorial. Cite this Article Format mla apa chicago Your Citation Bradley, Angela. "How to Add a Column to a MySQL Table." ThoughtCo, Aug. 26, 2020, thoughtco.com/add-column-mysql-command-2693988. Bradley, Angela. (2020, August 26). How to Add a Column to a MySQL Table. Retrieved from https://www.thoughtco.com/add-column-mysql-command-2693988 Bradley, Angela. "How to Add a Column to a MySQL Table." ThoughtCo. https://www.thoughtco.com/add-column-mysql-command-2693988 (accessed March 29, 2023). copy citation