My SQL Alter Command

Alter Table Drop A Column

Syntax

To DROP A COLUMN in an existing table, the Oracle ALTER TABLE syntax is:

ALTER TABLE table_name  DROP COLUMN column_name;

Example

Let’s look at an example that shows how to drop a column in an Oracle table using the ALTER TABLE statement.

For example:

ALTER TABLE customers  DROP COLUMN customer_name;

This Oracle ALTER TABLE example will drop the column called customer_name from the table called customers.

CategoriesMySql, Oracle

Alter table Modify

 

This command is used to alter table existing data type.By giving this command we can change the parameter of  an  table.

ALTER TABLE table_name  MODIFY column_name column_type;

alter table emp modify id number(20);

Alter Command For Add Renaming Column

 

Alter table command is used to modify the table structure we can add a column or modify column.

Syntax
ALTER TABLE table_name
ADD column_name datatype

eg-alter table test add mobile number(10);

Modifying a column

Syntax

ALTER TABLE “table_name”
RENAME COLUMN “column 1” TO “column 2”;

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *