MySQL批量修改命令

1.  查询操作

select * from tr_account             //选择tr_account表
where expire_date = '2020/9/30'      //查询expire_date为2020/9/30的所有数据
where account_number like 'BSTTEST00%'      //查询account_number为BSTTEST字符开头的所有数据(模糊查询)

2.  汇总操作

select COUNT(*) from tr_account          //选择tr_account表
where expire_date = '2020/9/30'          //条件为expire_date列等于2020/9/30

3.  将所有expire_date是“2020/9/30”更改为“2020-9-30”

UPDATE tr_account                      //更新tr_account表
SET expire_date = '2020-9-30'     //设置expire_date=2020-9-30
where expire_date = '2020/9/30'     //条件为expire_date=2020/9/30

4.  查询account_number为BSTTEST00开头的账号

select * from tr_account                          //选择表tr_account
where account_number like 'BSTTEST00%'        //条件
where account_number like 'BSTTEST00__'        //条件(后面两个下划线表示有两位字符)

 

posted on 2020-06-01 13:24  Lilongwei  阅读(854)  评论(0编辑  收藏  举报

导航