MySQL 更新表操作
修改多个列的值
#改邮箱、电话、身份证号 密码;多字段值修改,所有的值为相同。
#更新多个字段,使用','号分隔,并非使用and语句。
update base_user set password='34f688630e48fa637b15dd6071474d7', email=CONCAT('Dev_',email ), phone=18888888888, id_card_no=110108888888888888;
修改用户密码
#修改用户密码为'1234567'
UPDATE user SET password='fcea920f7412b5da7be0cf42b8c93759';
修改邮箱
UPDATE user SET email=CONCAT('Dev_',email )
UPDATE user SET email=CONCAT('Pvt_',email )
UPDATE user SET email=CONCAT('Uat_',email )
将Email中的Uat替换为Pvt
UPDATE user
SET email = REPLACE(email, 'Uat_', 'Pvt_')
WHERE email LIKE 'Uat_%';
#查询
select id, username, email, id_card_no, phone, real_name from user;
# mysql:批量更新某个列值,在原列值上统一增加固定文本值时如下操作。
UPDATE user SET email=CONCAT('Uat_',email )
#按条件修改指定的一条信息。
UPDATE user SET email=CONCAT('Uat_',email ) WHERE email='api_admin@baidu.com';
UPDATE user SET email='api_admin@baidu.com' WHERE email='Uat_api_admin@baidu.com';
修改电话
UPDATE user SET phone=18888888888;
修改身份证号
UPDATE user SET id_card_no=101101200001008888;
修改银行卡号
desc f_bank_account;
select id,uid,bank_name,card_no from f_bank_account;
UPDATE f_bank_account SET card_no=8888888888888888;
修改项目金额
#<--修改项目金额--->
select pro_amt from p_project_info;
UPDATE p_project_info set pro_amt='888888.88'
排序查询
# 根据ID排序取前500行数据:
select job_num, username, id, email from user order by id limit 1, 500;
select id,username,password from user where username='admin';
其它参考
show table status from confluence;
SELECT TABLE_NAME,TABLE_COLLATION FROM information_schema.TABLES;
show full columns from user;
评论区