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__'        //条件(后面两个下划线表示有两位字符)

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM