Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

add a column in a table

how to add a column in a table


is there a way without putting all the column names...
table is very big
0
rgb192
Asked:
rgb192
3 Solutions
 
tigin44Commented:
simply you can add it with the command...

ALTER TABLE tableName ADD columnName columnDataType

but Im not sure this is what you are looking for
0
 
leakim971PluritechnicianCommented:
Yes :

Add the column yourNewColumn to the table yourTable
A VARCHAR(20) can be NULL
ALTER TABLE yourTable ADD yourNewColumn VARCHAR(20) NULL

Open in new window

0
 
sureshchsahuCommented:
Here are the list of Alter command which will help you to use play with columns of the table

To add a column in a table, use the following syntax:
ALTER TABLE table_name ADD column_name datatype

To delete a column in a table, use the following syntax (notice that some database systems don't allow deleting a column):
ALTER TABLE table_name DROP COLUMN column_name

To change the data type of a column in a table, use the following syntax:
ALTER TABLE table_name ALTER COLUMN column_name datatype
0
 
rgb192Author Commented:
thanks
0
 
leakim971PluritechnicianCommented:
You're welcome!
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now