mysql操作基本命令
查看索引 : show index from table_name
创建索引:create index index_name on table_name(column_name) 创建唯一索引:create unique index index_name on table_name(column_name) 创建联合索引:create index index_name on table_name(column1_name,column2_name)
删除索引:drop index index_name on table_name
查看创建表语句:show create table table_name
新建表:create table table_name(
              id int not null auto_increment,
              name varchar(50) not null,
              age int not null,
              primary key(id)
);
插入语句:insert into table_name(column1_name, column2_name) values (column1_value,column2_value)
清空表中信息:truncate table table_name
查看所有列:show full columns from table_name
左连接: select a.name, b.name from A a left join B b on a.id = b.id; (以表A为标准)
右连接:
select a.name, b.name from A a right join B b on a.id = b.id; (以表B为标准)
内连接:
select a.name, b.name from A a inner join B b on a.id = b.id;
等价于
select a.name, b.name from A a, B b where a.id = b.id;
#!/bin/bash i=1; MAX_INSERT_ROW_COUNT=$1; while [ $i -le $MAX_INSERT_ROW_COUNT ] do mysql -uroot -proot dbname -e "insert into tablename (name,age,createTime) values ('HELLO$i',$i % 99,NOW());" d=$(date +%M-%d\ %H\:%m\:%S) echo "INSERT HELLO $i @@ $d" i=$(($i+1)) sleep 0.05 done exit 0
posted on 2018-08-01 19:05 www_practice 阅读(117) 评论(0) 收藏 举报
 
                    
                 
 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号