在MySQL中,创建带分区的表一切正常,如下:
create table t1 (
id int,
year_col int
)
partition by range (year_col) (
partition p0 values less than (1991),
partition p0 values less than (1995),
partition p0 values less than (1999)
);
但是创建完成之后,再想新增加一个分区p3,如下:
alter table t1 add partition p3 values less than (2002);
就会报如下错误:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'p3 values less than (2002)' at line 1
这个例子是MySQL官网上的,请明白的人帮忙解决下这个问题。
create table t1 (
id int,
year_col int
)
partition by range (year_col) (
partition p0 values less than (1991),
partition p0 values less than (1995),
partition p0 values less than (1999)
);
但是创建完成之后,再想新增加一个分区p3,如下:
alter table t1 add partition p3 values less than (2002);
就会报如下错误:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'p3 values less than (2002)' at line 1
这个例子是MySQL官网上的,请明白的人帮忙解决下这个问题。
-> id int,
-> year_col int
-> )
-> partition by range (year_col) (
-> partition p0 values less than (1991),
-> partition p1 values less than (1995),
-> partition p2 values less than (1999)
-> );
Query OK, 0 rows affected (0.03 sec)mysql>
mysql> alter table t1 add partition (PARTITION p3 values less than (2002));
Query OK, 0 rows affected (0.08 sec)
Records: 0 Duplicates: 0 Warnings: 0mysql>
ACMAIN_CHM啦!!!