In the above example, SQL Alter Query will add three columns, Name as varchar(20), UName as varchar(20), PWord as varchar(25) and Status as varchar(8) in USERS table

MODIFY COLUMN IN TABLE

Syntax

Different databases have different implementation of modify column command and hence variate in syntax. For modifying a column in an existing table, following syntax for different DBMS solutions are used.

For MySQL, MariaDB and Oracle Databases

Alter table tbl_name modify col_name col_type;

For SQL Server Database:

Alter table tbl_name alter column col_name col_type;

For PostgreSQL Database:

Alter table tbl_name alter column col_name type col_definition;

Example

Let’s try the above syntax one by one and see how they modify a column called Status using the alter table statement.