By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,917 Members | 656 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,917 IT Pros & Developers. It's quick & easy.

How to add columns in an existing table in phpmyadmin

P: 23
Hi,
How can i add(append) extra columns to a table using phpmyadmin? or through coding?
Thanks.
Nov 15 '06 #1
Share this Question
Share on Google+
5 Replies

ronverdonk
Expert 2.5K+
P: 4,258
- 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

P: 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

P: 23
Thanks a lot !!!!:-)
Hey ,How could i do the same using coding?
Nov 17 '06 #4

P: 1
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

P: 4
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.