I want to add a column to preexisting table. Can I add it in between two existing columns? I am working on phpmyadmin.
The syntax to add a column in a table in MySQL (using the ALTER TABLE statement) is: ALTER TABLE table_name ADD new_column_name column_definition [ FIRST | AFTER column_name ]; table_name.
If you know SQL then you probably know that you can add columns to an existing table in SQL Server using the ALTER command. It not only allows you to add a column but to drop columns as well. You can also add or drop constraints using the ALTER command.
Step 1: Create a new column with alter command. ALTER TABLE table_name ADD column_name datatype; Step 2: Insert data in a new column.
Use the add new column after dropdown.
Select the database from the menu on the left.
Select the table by clicking on it's title column hyperlink.
Check the add new column after radio button and select the column you want to insert after in the drop down.
Click Add.
This video goes through the process http://www.youtube.com/watch?v=jZ72GCGWPQg
You want something like:
ALTER TABLE contacts ADD email VARCHAR(60);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With