How can you add a column in Oracle?

To add a column to an Oracle table, you can use the ALTER TABLE statement. The general syntax for adding a column to a table is as follows:

ALTER TABLE table_name
ADD column_name data_type;

Here, table_name refers to the name of the table to which you want to add a column, column_name is the name of the column you want to add, and data_type is the data type of the column.

For instance, to add a new column named email with a data type of VARCHAR2(100) to a table called employees, you can execute the following ALTER TABLE statement:

ALTER TABLE employees
ADD email VARCHAR2(100);

This will add a new column named email to the employees table.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds