Alter table to drop unused columns : Alter Table « Table « Oracle PL / SQL






Alter table to drop unused columns

   


create table people(
  employee_id     number(9),
  first_name      varchar2(15),
  last_name       varchar2(20),
  email           varchar2(25),
  constraint pk_people primary key (employee_id)
);

insert into people
values (1, 'Tom', 'Kyte', 'YourName@q.com');

insert into people
values (2, 'Sean', 'Viper', 'sdillon@q.com');

insert into people
values (3, 'Christopher', 'Beck', 'clbeck@q.com');

select * from people;

alter table people drop column first_name;

alter table people drop column last_name;

select * from user_unused_col_tabs;

ALTER TABLE people DROP UNUSED COLUMNS;

drop table people;

   
    
  








Related examples in the same category

1.Alter table to add Columns in Tables
2.Alter table to add two columns to a table
3.Use alter table command to add foreign key constraint
4.Use alter table command to add foreign key with more than two columns
5.Use alter table to add foreign key with cascade delete
6.Use alter table to add foreign key with cascade delete for more than one column
7.Alter table to add a foreign key ON DELETE SET NULL
8.Alter to add DELETE ON NULL with more than one column
9.Alter table to drop two columns in a single command
10.Marking Columns Unused
11.Alter table to change the storage
12.Alter table cache
13.Alter table to drop constraints
14.If you are adding more than one column, the column definitions should be enclosed in parentheses and separated by commas.
15.Make myCode a CACHE table.