Jump to content

rename a column?


dadamssg

Recommended Posts

It's part of the syntax -

 

12.1.7. ALTER TABLE Syntax

 

ALTER [ONLINE | OFFLINE] [iGNORE] TABLE tbl_name

    alter_specification [, alter_specification] ...

 

alter_specification:

    table_option ...

  | ADD [COLUMN] col_name column_definition

        [FIRST | AFTER col_name ]

  | ADD [COLUMN] (col_name column_definition,...)

  | ADD {INDEX|KEY} [index_name]

        [index_type] (index_col_name,...) [index_option] ...

  | ADD [CONSTRAINT [symbol]] PRIMARY KEY

        [index_type] (index_col_name,...) [index_option] ...

  | ADD [CONSTRAINT [symbol]]

        UNIQUE [iNDEX|KEY] [index_name]

        [index_type] (index_col_name,...) [index_option] ...

  | ADD FULLTEXT [iNDEX|KEY] [index_name]

        (index_col_name,...) [index_option] ...

  | ADD SPATIAL [iNDEX|KEY] [index_name]

        (index_col_name,...) [index_option] ...

  | ADD [CONSTRAINT [symbol]]

        FOREIGN KEY [index_name] (index_col_name,...)

        reference_definition

  | ALTER [COLUMN] col_name {SET DEFAULT literal | DROP DEFAULT}

  | CHANGE [COLUMN] old_col_name new_col_name column_definition

 

If you don't need to do this inside of a program, you can probably directly rename your column in your favorite database management tool.

Link to comment
https://forums.phpfreaks.com/topic/159259-rename-a-column/#findComment-839991
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.