This may seem a silly question, but last night I was trying to add and edit columns in an existing table using MySQL commands and I couldn't get it to work.
I would like to know how to add a column to a table, and out of interest, I would also like to know how to edit the field name of the column.
Hope someone can help.
To add new columns in your table:
ALTER TABLE table_name ADD (
To rename a column:
For more information about ALTER TABLE syntax, look up the MySQL documentation.
ALTER TABLE table_name CHANGE old_column_name new_column_name INTEGER;
Thanks for your help.
Yeah, that seems good. It is annoying because I was looking up how to do this last night in a book I have and it didn't say to put the ALTER TABLE bit in front of the CHANGE part. No wonder it didn't work! Don't you just hate it when books presume you know something?!?!
Glad to know I could help.
I don't know if you are aware of this, but there is a GUI interface to administering MySQL. Try these: