下面一起來了解下MySQL數(shù)據(jù)庫管理之如何創(chuàng)建分區(qū)表,相信大家看完肯定會(huì)受益匪淺,文字在精不在多,希望MySQL數(shù)據(jù)庫管理之如何創(chuàng)建分區(qū)表這篇短內(nèi)容是你想要的。
創(chuàng)新互聯(lián)專注于企業(yè)成都營銷網(wǎng)站建設(shè)、網(wǎng)站重做改版、萊山網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5開發(fā)、購物商城網(wǎng)站建設(shè)、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為萊山等各大城市提供網(wǎng)站開發(fā)制作服務(wù)。
創(chuàng)建分區(qū)表 mysql> CREATE TABLE `LINEITEM` ( L_SHIPDATE DATE NULL, L_ORDERKEY INT NOT NULL, L_DISCOUNT DECIMAL(10,2) NOT NULL, L_EXTENDEDPRICE DECIMAL(10,2) NOT NULL, L_SUPPKEY INT NOT NULL, L_QUANTITY INT NOT NULL, L_RETURNFLAG CHAR(1) BINARY NULL, L_PARTKEY INT NOT NULL, L_LINESTATUS CHAR(1) BINARY NULL, L_TAX DECIMAL(10,2) NOT NULL, L_COMMITDATE DATE NULL, L_RECEIPTDATE DATE NULL, L_SHIPMODE CHAR(10) BINARY NULL, L_LINENUMBER INT NOT NULL, L_SHIPINSTRUCT CHAR(25) BINARY NULL, L_COMMENT VARCHAR(44) BINARY NULL, PRIMARY KEY (`L_ORDERKEY`, `L_LINENUMBER`,`L_SHIPDATE`) ) PARTITION BY RANGE COLUMNS (L_SHIPDATE) ( PARTITION p0 VALUES LESS THAN ('1993-01-01'), PARTITION p1 VALUES LESS THAN ('1994-01-01'), PARTITION p2 VALUES LESS THAN ('1995-01-01'), PARTITION p3 VALUES LESS THAN ('1996-01-01'), PARTITION p4 VALUES LESS THAN ('1997-01-01'), PARTITION p5 VALUES LESS THAN ('1998-01-01'), PARTITION p6 VALUES LESS THAN ('1999-01-01'), PARTITION p7 VALUES LESS THAN (MAXVALUE) ) 刪除 mysql> ALTER TABLE lineitem DROP PARTITION p7; 增加 mysql> ALTER TABLE lineitem ADD PARTITION (PARTITION p7 VALUES LESS THAN ('2000-01-01')); 拆分 mysql> ALTER TABLE lineitem REORGANIZE PARTITION p0 INTO ( PARTITION p199206 VALUES LESS THAN ('1992-07-01'), PARTITION p199212 VALUES LESS THAN ('1993-01-01') ); 合并 mysql> ALTER TABLE lineitem REORGANIZE PARTITION p199206,p199212 INTO ( PARTITION p0 VALUES LESS THAN ('1993-01-01') ); 交換分區(qū) mysql> CREATE TABLE `temp1992` ( `L_SHIPDATE` date NOT NULL DEFAULT '0000-00-00', `L_ORDERKEY` int(11) NOT NULL, `L_DISCOUNT` decimal(10,2) NOT NULL, `L_EXTENDEDPRICE` decimal(10,2) NOT NULL, `L_SUPPKEY` int(11) NOT NULL, `L_QUANTITY` int(11) NOT NULL, `L_RETURNFLAG` char(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `L_PARTKEY` int(11) NOT NULL, `L_LINESTATUS` char(1) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `L_TAX` decimal(10,2) NOT NULL, `L_COMMITDATE` date DEFAULT NULL, `L_RECEIPTDATE` date DEFAULT NULL, `L_SHIPMODE` char(10) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `L_LINENUMBER` int(11) NOT NULL, `L_SHIPINSTRUCT` char(25) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `L_COMMENT` varchar(44) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`L_ORDERKEY`,`L_LINENUMBER`,`L_SHIPDATE`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 mysql> ALTER TABLE lineitem EXCHANGE PARTITION p0 WITH TABLE temp1992; Query OK, 0 rows affected (0.24 sec)
看完MySQL數(shù)據(jù)庫管理之如何創(chuàng)建分區(qū)表這篇文章后,很多讀者朋友肯定會(huì)想要了解更多的相關(guān)內(nèi)容,如需獲取更多的行業(yè)信息,可以關(guān)注我們的行業(yè)資訊欄目。
當(dāng)前標(biāo)題:MySQL數(shù)據(jù)庫管理之如何創(chuàng)建分區(qū)表
文章地址:http://muchs.cn/article40/ghjhho.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供云服務(wù)器、域名注冊、定制網(wǎng)站、、App設(shè)計(jì)、用戶體驗(yàn)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)