How to insert columns at a specific position in existing table?

前端 未结 8 2108
野趣味
野趣味 2020-12-25 09:54

I created a table with 85 columns but I missed one column. The missed column should be the 57th one. I don\'t want to drop that table and create it again. I\'m looking to ed

8条回答
  •  半阙折子戏
    2020-12-25 10:32

    if you are saying ADD COLUMN column_name then it will throw error

    u have to try

     ALTER TABLE temp_name ADD My_Coumn INT(1) NOT NULL DEFAULT 1
    

    remember if table already has few record and u have to create new column then either u have to make it nullable or u have to define the default value as I did in my query

提交回复
热议问题