Master da Web
Back to Blog

Add Column to Existing MySQL Table

LucasOctober 20, 20121 min readUpdated on November 4, 2023

To add the“age” column of type “int (11)” to the“student” table, simply use the following SQL query:

ALTER TABLE aluno ADD idade int(11)

the above query will add the column“age” last column, if you want to define the position of the column use the following SQL query:

ALTER TABLE aluno ADD idade int(11) AFTER nome

The above query will add the“age” table after the“name” column.

And if you want the“age” column to be the first in the“student” table, the following instruction will satisfy you:

ALTER TABLE aluno ADD idade int(11) FIRST

 

Tags#add#column#mysql
Share

Need Hosting or Servers?

Discover our VPS, dedicated servers and professional hosting solutions

Related Articles

View all articles