MySQL - How to increase varchar size of an existing column in a database without breaking existing data?

后端 未结 7 2069
渐次进展
渐次进展 2020-12-13 05:32

I have a column that is currently varchar(100) and I want to make it 10000.

is it as simple as

alter table table_name set          


        
7条回答
  •  天命终不由人
    2020-12-13 06:11

    I'd like explain the different alter table syntaxes - See the MySQL documentation

    For adding/removing defaults on a column:

    ALTER TABLE table_name
    ALTER COLUMN col_name {SET DEFAULT literal | DROP DEFAULT}
    

    For renaming a column, changing it's data type and optionally changing the column order:

    ALTER TABLE table_name
    CHANGE [COLUMN] old_col_name new_col_name column_definition
    [FIRST|AFTER col_name]
    

    For changing a column's data type and optionally changing the column order:

    ALTER TABLE table_name
    MODIFY [COLUMN] col_name column_definition
    [FIRST | AFTER col_name]
    

提交回复
热议问题