How can I add a column to a table in DB2?
To add a column to a DB2 table, you can use the ALTER TABLE statement. Here is the basic syntax for adding a column.
ALTER TABLE table_name
ADD column_name column_data_type;
In this case, table_name refers to the name of the table where the field is to be added, column_name is the name of the field to be added, and column_data_type is the data type of the field.
Here is a specific example:
ALTER TABLE employees
ADD hire_date DATE;
The statement will add a field called “hire_date” of DATE type to a table named “employees”.