MYSQL
华夏小卒
每天都在看着ABC!虽然我不知道这条路究竟会怎么样,但我还是想一直走下去,一步一个脚印。。。
展开
-
【MYSQL】分组拼接列字段
create table testtb(keycol varchar(1),num int); insert into testtb select 'A',1; insert into testtb select 'B',1; insert into testtb select 'A',1; insert into testtb select 'A',2; insert into tes原创 2014-08-12 15:52:22 · 132 阅读 · 0 评论 -
通过shell脚本,创建有规则的分库分表
#!bin/bash for i in `seq 0 999` do if [ $(($i%2)) == 0 ] then mysql -uuser -ppassword -hIP -P3306 -e "use db1;drop table if exists testtb_$i; create table testtb_$i like testtb ; " else原创 2014-08-12 16:01:58 · 172 阅读 · 0 评论 -
通过shell脚本,创建有规则的分库分表
1、创建基本表 testtb2、执行shell脚本,创建testtb_0,testtb_1 ..... 分表3、分库规则:db1库表为testtb_0,testtb_2..... db2库表为testtb_1,testtb_3..... #!bin/bash for i in `seq 0 999` do if [ $(($i%2)) == 0 ] then mysql -u原创 2014-08-12 16:06:32 · 107 阅读 · 0 评论