470,810 Members | 1,272 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,810 developers. It's quick & easy.

How to add columns in an existing table in phpmyadmin

23
Hi,
How can i add(append) extra columns to a table using phpmyadmin? or through coding?
Thanks.
Nov 15 '06 #1
5 36284
ronverdonk
4,258 Expert 4TB
- click the db at the left side of the screen, tables are shown
- click the table name at the left side of the screen
- all columns are displayed at right hand side of screen
- below the column display there is a row
Expand|Select|Wrap|Line Numbers
  1. Add  field(s)At End of Table At Beginning of Table After column_name GO
At that line you can add a new column to the show table.

Ronald :cool:
Nov 15 '06 #2
glady
23
- click the db at the left side of the screen, tables are shown
- click the table name at the left side of the screen
- all columns are displayed at right hand side of screen
- below the column display there is a row
Expand|Select|Wrap|Line Numbers
  1. Add  field(s)At End of Table At Beginning of Table After column_name GO
At that line you can add a new column to the show table.

Ronald :cool:
Thanks a lot !!!!:-)
Nov 16 '06 #3
glady
23
Thanks a lot !!!!:-)
Hey ,How could i do the same using coding?
Nov 17 '06 #4
For add column:
Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE table_name add COLUMN column_name varchar(30)
For add column after specific filed,
Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE table_name add COLUMN column_name varchar(30) AFTER column_name
For add column at first
Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE table_name add COLUMN column_name varchar(30)FIRST
<Snip>
Jan 10 '14 #5
You can add column after particular field. The mysql query is
Expand|Select|Wrap|Line Numbers
  1. alter table table_name add column col_name datatype(length) after field_name
where, you need to use "after" keyword

Similarly, you can also add column at first of table. the query is
Expand|Select|Wrap|Line Numbers
  1. alter table table_name add column col_name first
Here you need to use "first" keyword
Jul 3 '14 #6

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Wayne Wengert | last post: by
16 posts views Thread by scoots987 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.