Home > database >  Mysql statement
Mysql statement

Time:09-27

Use Mysql statement write five years the partition table on a monthly basis

CodePudding user response:

Consult the MYSQL example in official free manual, such as the following,
The CREATE TABLE employees (
Id INT the NOT NULL,
Fname VARCHAR (30),
Lname VARCHAR (30),
Hired DATE NOT NULL DEFAULT '1970-01-01',
Separated the DATE NOT NULL DEFAULT '9999-12-31',
Job_code INT,
Store_id INT
)
PARTITION BY RANGE (YEAR (separated)) (
PARTITION p0 VALUES LESS THAN (1991),
PARTITION p1 VALUES LESS THAN (1996),
PARTITION p2 VALUES LESS THAN (2001),
PARTITION p3 VALUES LESS THAN MAXVALUE
);

CodePudding user response:

It is ok to spell or use the stored procedure cycle
Depending on your partition table creation statements, and add a partition or create a partitioned table directly
  • Related