Add column into existing table

Syntax 1
To add a column into an existing table :

ALTER TABLE table_name ADD column_name column-definition;
Contoh :
ALTER TABLE customers ADD name varchar2(50);

Syntax above adding column name into customers table with data type varchar2 dan length 50.
-------------------------------------------------
Syntax 2
To add columns into existing table:
ALTER TABLE table_name
ADD (
column_1 column-definition,
column_2 column-definition,
...
column_n column_definition );

Contoh:
ALTER TABLE customers
ADD ( name varchar2(50),
address varchar2(100),
country varchar2(45) );

Syntaxs above adding three fields name, address, and country into customers table.

No comments: