Alter Table In MySQL
Here is a scenario. We have an existing database table. It has beed working for us
for a very long time. This means, it contains tons of data. Then, a requirement came
to add an additional column to that specific table. Lets use use the
database tables we created in the previous lesson.
By executing the above code, we added a column 'FULL_NAME' with a data type of 'VARCHAR'. This is how you will
verify how your table structure is.
If you wish to remove a database table column, the LATER TABLE statement is also what you need to use. Here is an
example of how you will do it.
ALTER TABLE ACCOUNT ADD FULL_NAME VARCHAR(60);
If you pay attention to the above code, we needed to mention the keyword 'COLUMN' after we mentioned the
keyword 'DROP'. The 'COLUMN' is then followed by the column name we wish to remove. Verify your table again.
ALTER TABLE ACCOUNT DROP COLUMN FULL_NAME;