日期:2014-05-16 浏览次数:20857 次
CREATE TABLE `tushumulu` ( `id` int(11) NOT NULL, //想设置为自动增涨的 `isbn` int(11) NOT NULL, //这个字段值会重复的 `juan` varchar(30) NOT NULL, //这个字段值会重复的 `zhangjie` varchar(60) NOT NULL, //这个字段值会重复的 `yeshu` varchar(100) NOT NULL, //这个字段值会重复的 `contents` varchar(200) NOT NULL, //这个字段值会重复的 `zishu` int(5) NOT NULL, `gengxinshijian` datetime NOT NULL //这个不会 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 PARTITION BY RANGE (isbn) (PARTITION p0 VALUES LESS THAN (1100) ENGINE = InnoDB, PARTITION p1 VALUES LESS THAN (1200) ENGINE = InnoDB, PARTITION p2 VALUES LESS THAN (1300) ENGINE = InnoDB, PARTITION p3 VALUES LESS THAN (1400) ENGINE = InnoDB, PARTITION p4 VALUES LESS THAN (1500) ENGINE = InnoDB, PARTITION p5 VALUES LESS THAN (1600) ENGINE = InnoDB, PARTITION p6 VALUES LESS THAN (1700) ENGINE = InnoDB, PARTITION p7 VALUES LESS THAN (1800) ENGINE = InnoDB, PARTITION p8 VALUES LESS THAN (1900) ENGINE = InnoDB, PARTITION p9 VALUES LESS THAN (2000) ENGINE = InnoDB )
mysql> CREATE TABLE `tushumulu` ( -> `isbn` int(11) NOT NULL primary key, -> `juan` varchar(30) NOT NULL, -> `zhangjie` varchar(60) NOT NULL, -> `yeshu` varchar(100) NOT NULL, -> `contents` varchar(200) NOT NULL, -> `zishu` int(5) NOT NULL, -> `gengxinshijian` datetime NOT NULL -> ) ENGINE=InnoDB -> PARTITION BY RANGE (isbn) -> (PARTITION p0 VALUES LESS THAN (1100) ENGINE = InnoDB, -> PARTITION p1 VALUES LESS THAN (1200) ENGINE = InnoDB, -> PARTITION p2 VALUES LESS THAN (1300) ENGINE = InnoDB, -> PARTITION p3 VALUES LESS THAN (1400) ENGINE = InnoDB, -> PARTITION p4 VALUES LESS THAN (1500) ENGINE = InnoDB, -> PARTITION p5 VALUES LESS THAN (1600) ENGINE = InnoDB, -> PARTITION p6 VALUES LESS THAN (1700) ENGINE = InnoDB, -> PARTITION p7 VALUES LESS THAN (1800) ENGINE = InnoDB, -> PARTITION p8 VALUES LESS THAN (1900) ENGINE = InnoDB, -> PARTITION p9 VALUES LESS THAN (2000) ENGINE = InnoDB -> ); Query OK, 0 rows affected (1.25 sec) mysql>
------解决方案--------------------
PARTITION BY RANGE (id,isbn)