Use the ALTER TABLE statement to append, modify, or delete the syntax of a column
1Sql> desctesttable;2Name Type NullableDefaultComments3 -------- ------------ -------- ------- -------- 4EMPNO Number(4) Y5EnameVARCHAR2(Ten) Y6JOBVARCHAR2(9) Y7MGR Number(4) Y8 hiredate DATE Y9SAL Number(7,2) YTenCOMM Number(7,2) Y OneDEPTNO Number(2) Y A -Sql>--Add Columns -Sql> Alter Tabletesttable the 2 AddPhoto Blob - 3 ; - TableAltered - +Sql> desctesttable; -Name Type NullableDefaultComments + -------- ------------ -------- ------- -------- AEMPNO Number(4) Y atEnameVARCHAR2(Ten) Y -JOBVARCHAR2(9) Y -MGR Number(4) Y - hiredate DATE Y -SAL Number(7,2) Y -COMM Number(7,2) Y inDEPTNO Number(2) Y - PHOTO BLOB Y to +Sql>--Modifying column types -Sql> Alter Tabletesttable the 2Modify Deptno Number(3); * TableAltered $ Panax NotoginsengSql> desctesttable; -Name Type NullableDefaultComments the -------- ------------ -------- ------- -------- +EMPNO Number(4) Y AEnameVARCHAR2(Ten) Y theJOBVARCHAR2(9) Y +MGR Number(4) Y - hiredate DATE Y $SAL Number(7,2) Y $COMM Number(7,2) Y -DEPTNO Number(3) Y - PHOTO BLOB Y the -Sql>--Delete ColumnWuyiSql> Alter Tabletesttable the 2 Drop columnphoto; - TableAltered Wu -Sql> desctesttable; AboutName Type NullableDefaultComments $ -------- ------------ -------- ------- -------- -EMPNO Number(4) Y -EnameVARCHAR2(Ten) Y -JOBVARCHAR2(9) Y AMGR Number(4) Y + hiredate DATE Y theSAL Number(7,2) Y -COMM Number(7,2) Y $DEPTNO Number(3) Y the theSql>--Modify column names theSql> Alter Tabletesttable the 2Renamecolumn - 3Deptno toDNO; in TableAltered the theSql> desctesttable; AboutName Type NullableDefaultComments the -------- ------------ -------- ------- -------- theEMPNO Number(4) Y theEnameVARCHAR2(Ten) Y +JOBVARCHAR2(9) Y -MGR Number(4) Y the hiredate DATE YBayiSAL Number(7,2) Y theCOMM Number(7,2) Y theDNO Number(3) Y
Oracle uses the ALTER action column