mysql資料庫新增和修改欄位

ProZkb發表於2024-11-01

8.0版本之上

-- 修改舊欄位名為新欄位名
ALTER TABLE bd_material_circuit_breaker 
    RENAME COLUMN release_type TO release_type_zh;

ALTER TABLE bd_material_circuit_breaker 
    RENAME COLUMN control_type TO control_type_zh;

ALTER TABLE bd_material_circuit_breaker 
    RENAME COLUMN installation_method TO installation_method_zh;

-- 新增英文欄位
ALTER TABLE bd_material_circuit_breaker 
    ADD COLUMN release_type_en VARCHAR(255) COMMENT '脫扣器型別en';

ALTER TABLE bd_material_circuit_breaker 
    ADD COLUMN control_type_en VARCHAR(255) COMMENT '控制型別en';

ALTER TABLE bd_material_circuit_breaker 
    ADD COLUMN installation_method_en VARCHAR(255) COMMENT '安裝方式en';

5.7版本

ALTER TABLE bd_material_circuit_breaker 
    CHANGE COLUMN release_type release_type_zh VARCHAR(255) COMMENT '脫扣器型別zh';



ALTER TABLE bd_material_circuit_breaker 
    CHANGE COLUMN control_type control_type_zh VARCHAR(255) COMMENT '控制型別zh';
        
    

ALTER TABLE bd_material_circuit_breaker 
    CHANGE COLUMN installation_method installation_method_zh VARCHAR(255) COMMENT '安裝方式zh';
    
    
    



ALTER TABLE bd_material_circuit_breaker 
    ADD COLUMN release_type_en VARCHAR(255) COMMENT '脫扣器型別en';
    
    
ALTER TABLE bd_material_circuit_breaker 
    ADD COLUMN control_type_en VARCHAR(255) COMMENT '控制型別en';
    
ALTER TABLE bd_material_circuit_breaker 
    ADD COLUMN installation_method_en VARCHAR(255) COMMENT '安裝方式en';

相關文章