Oracle

The ALTER TABLE Statement

Figo Kim 2006. 12. 1. 16:00
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
  • Add a new column
  • Modify an existing column
  • Define a default value for the new column
  • Drop a column

<Syntax>

ALTER TABLE     table

ADD        (column datatype [DEFAULT expr ]

        [, column datatype] …..);

 

ALTER TABLE    table

MODIFY    (column datatype [DEFAULT expr]

        [, column datatype] ……..);

 

ALTER TABLE     table

DROP        (column);


- DEFAULT expr : specifies the default value for a new column

Adding a Column

Ex)

ALTER TABLE     dept80

ADD        (job_id     VARCHAR));


* The new column becomes the last column.
* If a table already contains row when a column is added, then the new column is initially null for all the rows.
* Can not add a mandatory NOT NULL column to a table that contains data in the other columns. (To an empty table, it's possible.)

'Oracle' 카테고리의 다른 글

ALTER table statement (2)  (0) 2006.12.01
The ALTER TABLE Statement  (0) 2006.12.01
Object Privileges  (0) 2006.12.01
Object Privileges  (0) 2006.12.01
Object Privileges  (0) 2006.12.01