

To illustrate these concepts, let us create a programming_languages database with a table named Details.

The CHANGE or MODIFY keywords achieve the same result, with slight trade-offs in terms of convenience of syntax and robustness. The MODIFY keyword is an available extension for the sake of compatibility with Oracle. In MySQL, the CHANGE keyword is the main extension to the standard SQL. The ALTER TABLE keyword can combine with other keywords for achieving the necessary modification. Change Column Datatype or Property in MySQL This tutorial illustrates using the ALTER TABLE keyword for modifying the datatype, constraints, or properties of existing columns in a MySQL database. MySQL is a robust RDBMS that allows the modification ofĮxisting/declared table columns with the ALTER TABLE keyword. Of a Single Column in a MySQL Database Tableĭatabase design is often iterative, with requirements changing and initial design re-adjusted.

MODIFY can only be used to change a column definition and RENAME COLUMN can change a column’s name but not its definition. To change the data type of a column, use MODIFY:ĪLTER TABLE table_name MODIFY col_name new_type ĪLTER TABLE table_name RENAME COLUMN old_col_name TO new_col_name

