COLUMN

SQL COLUMN Keyword

The COLUMN keyword is used with ALTER TABLE to modify the structure of an existing table. This includes changing a column’s data type or deleting a column.

Tutorials dojo strip

SQL ALTER COLUMN Syntax

The ALTER COLUMN command is used to change the data type of a column in a table.

SQL

SQL ALTER COLUMN Example

MySQL / SQL Server / Oracle / MS Access:

This example changes the data type of the column EngineCode in the Vehicles table to a string with a maximum length of 10 characters.

SQL

Note: SQLite including the TechKubo playground does not support the ALTER COLUMN syntax. To change a column’s data type in SQLite you must recreate the table.

SQL DROP COLUMN Syntax

The DROP COLUMN command is used to remove a column from an existing table.

SQL

SQL DROP COLUMN Example

MySQL / SQL Server / Oracle / MS Access:

This example removes the column EngineCode from the Vehicles table.

SQL

Note: SQLite including the TechKubo playground does not support DROP COLUMN using ALTER TABLE. To drop a column in SQLite you must recreate the table without the unwanted column.

SQL COLUMN Labs

Tutorials dojo strip