|
Author |
Message |
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Tue Apr 29, 2003 11:09 pm (21 years, 8 months ago) |
|
How do I add a column to a table once I have already created the table? |
|
|
|
|
drathbun
WebHelper
Joined: 01 Mar 2003
Posts: 69
Location: Texas
|
Posted:
Wed Apr 30, 2003 1:22 am (21 years, 8 months ago) |
|
Here's a link you might find helpful:
MySQL Manual
Specifically:
Code: | ALTER [IGNORE] TABLE tbl_name alter_spec [, alter_spec ...]
alter_specification:
ADD [COLUMN] create_definition [FIRST | AFTER column_name ]
or ADD [COLUMN] (create_definition, create_definition,...)
or ADD INDEX [index_name] (index_col_name,...)
or ADD PRIMARY KEY (index_col_name,...)
or ADD UNIQUE [index_name] (index_col_name,...)
or ADD FULLTEXT [index_name] (index_col_name,...)
or ADD [CONSTRAINT symbol] FOREIGN KEY [index_name] (index_col_name,...)
[reference_definition]
or ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}
or CHANGE [COLUMN] old_col_name create_definition
[FIRST | AFTER column_name]
or MODIFY [COLUMN] create_definition [FIRST | AFTER column_name]
or DROP [COLUMN] col_name
or DROP PRIMARY KEY
or DROP INDEX index_name
or DISABLE KEYS
or ENABLE KEYS
or RENAME [TO] new_tbl_name
or ORDER BY col
or table_options
|
Simple example:
Code: | Alter table some_table add (new_column_definition); |
Dave |
________________________________ Dave
Photography Site :: Query Tools Forum :: Weekend Fun |
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.132313 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |