Jump to content
Larry Ullman's Book Forums

Going Back And Adding Columns After Table Is Created


Recommended Posts

I am in chptr. 9 Script 9.1 and have realized that i did not include the registration date in the users table when creating it, so the script wont run. I need to add the registration date column to the users table. What would be the easiest way to do it? would it be easier to just start all over?

Link to comment
Share on other sites

You can add the column using the ALTER TABLE command and give it a default value, e.g.

ALTER TABLE `tablename` ADD `registration_date` DATETIME NOT NULL DEFAULT NOW()

 

or the phpmyadmin interface gives you an option to add a column and select its position in relation to the other columns.

  • Upvote 1
Link to comment
Share on other sites

 Share

×
×
  • Create New...