affiliate marketing Interview Qns: Can one drop a column from a table?

Monday, October 25, 2010

Can one drop a column from a table?

From Oracle8i one can DROP a column from a table. Look at this sample script, demonstrating the ALTER TABLE table_name DROP COLUMN column_name; command.
Other workarounds:
1. SQL> update t1 set column_to_drop = NULL;
SQL> rename t1 to t1_base;
SQL> create view t1 as select from t1_base;

2. SQL> create table t2 as select from t1;
SQL> drop table t1;
SQL> rename t2 to t1;

No comments:

Post a Comment