Question:
Help with sql statement ALTER TABLE?
anonymous
2009-07-08 12:42:25 UTC
Is it possible to add more than one column at a time using the ALTER TABLE command? For example:

ALTER TABLE employees ADD userid varchar2(50)

But lets say you want to add two or more columns, can you do something like this?

ALTER TABLE employees ADD userid varchar2(50), lastname varchar2(5), firstname varchar2(50)

etc.
Three answers:
Abimaelrc
2009-07-08 13:13:49 UTC
You can do it, but like this



ALTER TABLE employees

ADD userid varchar2(50) ,

ADD astname varchar2(5),

ADD firstname varchar2(50)



If you are using MySQL, I suggest that you use phpMyAdmin to add, edit or erase is very easy to use
jp_dfw
2009-07-08 12:55:31 UTC
You use multiple ADDs separated by commas...

ALTER TABLE foo ADD userid varchar(50), ADD lastname varchar(5), ADD firstname varchar(50);
oscar
2014-12-11 00:25:41 UTC
complex stuff. seek from bing and yahoo. just that could actually help!


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...