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