步驟:
create table t_sys_test_temp like t_sys_test;
alter table t_sys_test_temp add index age_index(age);
INSERT into t_sys_test_temp(id,name,age,card_id,address,create_time,update_time,manager_id,deleted,sex) select id,name,age,card_id,address,create_time,update_time,manager_id,deleted,sex from t_sys_test rename table t_sys_test to temp2 ,t_sys_test_temp to t_sys_test ;
drop table temp2;
1先創建臨時表t_sys_test_temp
2向臨時表t_sys_test_temp 添加索引
3將目標表的數據查詢出來插入到臨時表,再將目標表t_sys_test重命名為temp2,
將臨時表t_sys_test_temp 重命名為結果表t_sys_test
4刪除臨時表temp2
