Mysql Partition Table restrictions on Functions

Source: Internet
Author: User

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

 
 
  1. mysql> CREATE TABLE t (c FLOAT) PARTITION BY LIST( FLOOR(c) )(      
  2.     -> PARTITION p0 VALUES IN (1,3,5),   
  3.     -> PARTITION p1 VALUES IN (2,4,6)   
  4.     -> );;  
  5. ERROR 1491 (HY000): The PARTITION function returns the wrong type   
  6.  
  7. mysql> CREATE TABLE t (c int) PARTITION BY LIST( FLOOR(c) )(   
  8.     -> PARTITION p0 VALUES IN (1,3,5),   
  9.     -> PARTITION p1 VALUES IN (2,4,6)   
  10.     -> );  
  11. 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.