Oracle Column Add, Resize/Modify, Drop

ADD

/*One Column */  ALTER TABLE customers ADD customer_name varchar2(45);

/*Multiple Columns*/ ALTER TABLE customers ADD (customer_name varchar2(45), city varchar2(40));

MODIFY

/*One Column*/  ALTER TABLE customers MODIFY customer_name varchar2(100) not null;

/*Multiple Columns*/ ALTER TABLE customers MODIFY (customer_name varchar2(100) not null, city varchar2(75));

DROP

ALTER TABLE customers DROP COLUMN customer_name;

Bonus: 🙂
RENAME

ALTER TABLE customers RENAME COLUMN customer_name to cname;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: