当前位置:网站首页>Advanced database · how to add random data for data that are not in all user data - Dragonfly Q system users without avatars how to add avatar data - elegant grass technology KIR
Advanced database · how to add random data for data that are not in all user data - Dragonfly Q system users without avatars how to add avatar data - elegant grass technology KIR
2022-07-25 22:11:00 【~ central qianche ~】
Database advanced · How to add random data for data that is not in all user data - Dragonfly Q System users do not have avatars how to add avatar data - Elegant grass technology kir
This content is mainly used for learning , The avatar is just a field for example , It can be applied in other aspects , The lines
The problem background :
Dragonfly q The ultimate version automatically assigns user accounts and logs in according to the mobile device information , Skipped the steps of user registration and uploading avatar , Therefore, a large number of users do not have avatars ,

At this time, you need to add random avatars to these users to sort out the following running statements :
update users
set avatar='http://qingtingcun.youyacao.com/qiniu_202110270837150713870048.png'
where id IN(
select A.* from(select id from users where avatar='' order by rand() limit 10) AS A
);This sentence is found randomly every time 10 If there is no avatar, update it to the specified avatar address :
http://qingtingcun.youyacao.com/qiniu_202110270837150713870048.png
So if we want to update several different avatars randomly, the code is
update users
set avatar=' picture 1'
where id IN(
select A.* from(select id from users where avatar='' order by rand() limit 10) AS A
);
update users
set avatar=' picture 2'
where id IN(
select A.* from(select id from users where avatar='' order by rand() limit 10) AS A
);
update users
set avatar=' picture 3'
where id IN(
select A.* from(select id from users where avatar='' order by rand() limit 10) AS A
);So it is randomly updated to these three avatars , And so on , If you put more avatars and execute them more times, it will soon ok 了 .

effect

Do it a few more times , Until prompted 0 If the row is affected, it means that all users have added avatars .

边栏推荐
- jsp九大内置对象
- What is class loading? Class loading process?
- What have I experienced to become a harder tester than development?
- 开户就可以购买收益在百分之六以上的理财产品了吗
- Sofa weekly | open source person - Niu Xuewei, QA this week, contributor this week
- What should I do if I encounter the problem of verification code during automatic testing?
- Mouseevent event -- mouse coordinate description -- Focus event -- input event -- throttle -- mousewheel (wheel event)
- 数据库进阶·如何针对所有用户数据中没有的数据去加入随机的数据-蜻蜓Q系统用户没有头像如何加入头像数据-优雅草科技kir
- 聚名十年,说出你的故事,百万豪礼等你拿
- Don't know mock test yet? An article to familiarize you with mock
猜你喜欢

H5 lucky scratch lottery free official account + direct operation

自动化测试岗花20K招人,到最后居然没一个合适的,招两个应届生都比他们强吧

JMeter websocket interface test

如何实现一个App应用程序,限制用户时间使用?

MySQL --- 子查询 - 列子查询(多行子查询)

Randomly generate 10 (range 1~100) integers, save them to the array, and print the array in reverse order. And find the average value, the maximum value and the subscript of the maximum value, and fin

在腾讯干软件测试3年,7月无情被辞,想给划水的兄弟提个醒...

如何将一个域名解析到多个IP地址?

『SignalR』. Net using signalr for real-time communication

TS:typora代码片段缩进显示异常(已解决)-2022.7.24
随机推荐
什么是分区分桶?
Victoriametrics single node of kubernetes
五种分配方式是否会产生内部碎片、外部碎片
Whether the five distribution methods will produce internal fragments and external fragments
6-18漏洞利用-后门连接
Detailed summary of C language game dual cache to solve the flash screen problem [easy to understand]
zigbee开发板(nxpzigbee开发)
What should I do if I encounter the problem of verification code during automatic testing?
C language: random generated number + bubble sort
如何实现一个App应用程序,限制用户时间使用?
[assembly language 01] basic knowledge
SQL中in的用法 DQL 查询
Why does redis choose single thread?
Special class design
Flex layout
Basic knowledge in the project
2day
6-17 vulnerability exploitation - deserialization remote command execution vulnerability
What is partition and barrel division?
C language: random generated number + selective sorting