Altering the data type of a column
Changing the data type of a column after it is defined or added to a table using ALTER TABLE.
Using ALTER TABLE, you can change the data type of a column after it is defined or added to a table.
favorite_colorcolumn to store as
varcharby changing the data type of the column.
ALTER TABLE cycling.cyclist_alt_stats ADD favorite_color varchar; ALTER TABLE cycling.cyclist_alt_stats ALTER favorite_color TYPE text;
Only newly inserted values will be created with the new type. However, the data type before must be compatible with the new data type specified.