change column in sql code example

Example 1: sql add column

ALTER TABLE Customers
ADD Email varchar(255);

Example 2: alter table modify column

-- ORACLE 18c
ALTER TABLE table_name 
MODIFY column_name datatype;

-- Example
ALTER TABLE product
MODIFY description VARCHAR2(500 char);

Example 3: how to add column to table sql

ALTER TABLE table_name ADD column_name varchar(50);

Example 4: change column name sql

ALTER TABLE `db_name`.`table_name` 
	CHANGE `current_column_name` `new_column_name` datatype(size) NOT NULL COMMENT '';

Example 5: sql alter column

Changes the data type of a table’s column.
Example: In the ‘users’ table, make the column ‘incept_date’ into a
‘datetime’ type.
ALTER TABLE users
ALTER COLUMN incept_date datetime;

Example 6: change column name sql

ALTER TABLE users
 ALTER COLUMN first username varchar(20);

Tags:

Php Example