Mysql partition tables not only have limitations on primary key constraints, but also have some restrictions on the functions used by Mysql Partition Table statements. Let's take a look at the following.
The statement for creating a Mysql Partition Table in mysql5.1 can only contain the following functions:
ABS ()
CEILING () and FLOOR () when using these two functions to create a Mysql partition table, the premise is that the partition key of the function is INT type), such
- mysql> CREATE TABLE t (c FLOAT) PARTITION BY LIST( FLOOR(c) )(
- -> PARTITION p0 VALUES IN (1,3,5),
- -> PARTITION p1 VALUES IN (2,4,6)
- -> );;
- ERROR 1491 (HY000): The PARTITION function returns the wrong type
-
- mysql> CREATE TABLE t (c int) PARTITION BY LIST( FLOOR(c) )(
- -> PARTITION p0 VALUES IN (1,3,5),
- -> PARTITION p1 VALUES IN (2,4,6)
- -> );
- Query OK, 0 rows affected (0.01 sec)
DAY ()
DAYOFMONTH ()
DAYOFWEEK ()
DAYOFYEAR ()
DATEDIFF ()
EXTRACT ()
HOUR ()
MICROSECOND ()
MINUTE ()
MOD ()
MONTH ()
QUARTER ()
SECOND ()
TIME_TO_SEC ()
TO_DAYS ()
WEEKDAY ()
YEAR ()
YEARWEEK ()
How to modify MySQL Environment Variables
Example of creating a MySQL Stored Procedure
Mysql Stored Procedure Call Method
Use of mysql ifnull Functions
MySQL date functions