mysql 分割槽示例

jidongzheng發表於2011-12-29

建立表:

CREATE TABLE employees (
id INT NOT NULL,
fname VARCHAR(30),
lname VARCHAR(30),
hired DATE NOT NULL DEFAULT '1970-01-01',
separated DATE NOT NULL DEFAULT '9999-12-31',
job_code INT,
store_id INT
)
PARTITION BY LIST(store_id) (
PARTITION pNorth VALUES IN (3,5,6,9,17),
PARTITION pEast VALUES IN (1,2,10,11,19,20),
PARTITION pWest VALUES IN (4,12,13,14,18),
PARTITION pCentral VALUES IN (7,8,15,16)
);

[@more@]

刪除分割槽:
ALTER TABLE employees DROP PARTITION pNorth ;

新增分割槽

ALTER TABLE employees ADD PARTITION ( PARTITION p_111 VALUES IN (111) ) ;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/197458/viewspace-1056974/,如需轉載,請註明出處,否則將追究法律責任。

相關文章