EXP ON DDL

ALTER
1)ALTER used to add new column
Syntax:
ALTER TABLE tablenmae ADD columnname datatype(width);
Ex:ALTER TABLE students ADD aggr number(10,2);




2)ALTER used to modify datatype of existing column
Syntax:
ALTER TABLE tablenmae MODIFY columnname newdatatype(width);
Ex:ALTER TABLE students MODIFY rollno varchar2(10);


3)ALTER used to modify width of datatype of existing column
Syntax:
ALTER TABLE tablenmae MODIFY columnname datatype(newwidth);
Ex:ALTER TABLE students MODIFY name varchar2(20);



4)ALTER used to remove  existing column
Syntax:
ALTER TABLE tablename DROP  COLUMN columnname;
Ex:ALTER TABLE students DROP COLUMN rollno;




5)ALTER used to rename existing column
Syntax:
ALTER TABLE tablename RENAME  COLUMN oldcolumnname  TO newcolumnname;
Ex:ALTER TABLE students RENAME COLUMN dob TO dateofbirth;

3)RENAME
Used to rename the table.
Syntax:RENAME oldtablename TO newtablename;
EX:RENAME students TO collegestudents;






4)TRUNCATE used to delete all data from the table.
Syntax:TRUNCATE TABLE tablename;
Ex:TRUNCATE TABLE collegestudents;





5)DROP
Used to remove the table

Syntax:DROP TABLE tablename;


Ex: DROP TABLE collegestudents;