当前位置:网站首页>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 .

边栏推荐
- The technical aspects of ByteDance are all over, but the result is still brushed. Ask HR why...
- QML module not found
- 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
- 手机端微信发朋友圈功能测试点总结
- 文件无法保存(文件夹已损坏无法读取怎么办)
- Unity performance optimization direction
- Why is the integer type 128 to byte -128
- 6-18漏洞利用-后门连接
- 启牛商学院和微淼商学院哪个靠谱?老师推荐的开户安全吗?
- ZigBee development board (nxpzigbee Development)
猜你喜欢

On the difference between break and continue statements

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

8000 word super detailed custom structure type

Jmeter--- set proxy recording request

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

2day

H5幸运刮刮乐抽奖 免公众号+直运营

Summary of function test points of wechat sending circle of friends on mobile terminal

字节跳动技术面都过了,结果还是被刷了,问HR原因竟是。。。

『SignalR』. Net using signalr for real-time communication
随机推荐
3. Editors (vim)
虚拟内存与磁盘
『Skywalking』. Net core fast access distributed link tracking platform
6-17 vulnerability exploitation - deserialization remote command execution vulnerability
TFrecord写入与读取
C语言:随机生成数+冒泡排序
动画曲线天天用,你能自己整一个吗?看完这篇你就会了!
[fan Tan] in detail: lower control, upward management, upward drawing cake.
How to use RS485 half duplex chip correctly
Wechat applet application development competition works comprehensive development record - Jinlu cultural tourism (cloud development - Overview)
Redis foundation 2 (notes)
Playwright tutorial (I) suitable for Xiaobai
Redis基础2(笔记)
What is partition and barrel division?
信息安全建设原则指导
The second short contact of gamecloud 1608
JSP初识
The technical aspects of ByteDance are all over, but the result is still brushed. Ask HR why...
卸载npm和安装npm_使用`npm uninstall`卸载npm软件包「建议收藏」
How to quickly build a picture server [easy to understand]