• mysql添加删除索引


    mysql> show create table table_test;
    +---------------------------------------+---------------------------+
    | Table | Create Table |
    +---------------------------------------+---------------------------+
    | table_test | CREATE TABLE `table_test` (
    `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '涓婚敭',
    `activity_id` varchar(20) NOT NULL COMMENT '娲诲姩ID',
    `store_code` varchar(100) NOT NULL COMMENT '娲诲姩鍚嶇О',
    `generation_date` date DEFAULT NULL COMMENT '鐢熸垚鏃ユ湡,鏍煎紡锛歽yyy-MM-dd',
    `ordercon_num` bigint(20) DEFAULT '0' COMMENT '璁㈠崟杞�寲浜烘暟',
    `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '鍒涘缓鏃堕棿',
    `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '鏇存柊鏃堕棿',
    `delete_flag` varchar(1) DEFAULT '1' COMMENT '鐘舵€?1-鍚�敤锛?-鍒犻櫎',
    PRIMARY KEY (`id`),
    UNIQUE KEY `uk_activityid_date` (`activity_id`,`generation_date`) USING BTREE,
    KEY `idx_storecode` (`store_code`) USING BTREE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='搴楅摵缁村害澶╄〃' |
    +---------------------------------------+---------------------------
    乱码正好算加密了~

    删除联合主键索引:

    ALTER TABLE table_test DROP INDEX `uk_activityid_date`;

    添加索引:

    ALTER TABLE table_test ADD INDEX `idx_activityid` (`activity_id`) USING BTREE;
  • 相关阅读:
    flush()方法
    多对一关联映射(manytoone)
    Hibernate配置数据库解决插入乱码问题
    lazy
    一对多关联映射(单向)
    属性类的映射
    多对多关联(双向)
    多对多关联映射(单向)
    多态查询
    Visual C# 2008+SQL Server 2005 数据库与网络开发11.2.2 LINQ的基本查询操作
  • 原文地址:https://www.cnblogs.com/yoyotl/p/13212999.html
Copyright © 2020-2023  润新知