Using QMF


Adding a new column to a table using SQL statements

You use the ALTER TABLE SQL statement to add a new column to a table.

For example, to add a NOTES column to the CALENDAR table, run the following SQL statement:

ALTER TABLE CALENDAR
ADD NOTES VARCHAR(40)

NOTES is the name of the new column, VARCHAR is the data type, and 40 is the number of characters in the column.

If you are storing the table in a DB2 database, you can specify a default value other than null for the column. If you are storing the table in an SQL/DS database, the default value must be null for the column.

For more information on the ALTER TABLE SQL statement, see the SQL reference manual for your database management system.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]