当前位置:网站首页>MySQL面试真题(二十二)——表连接后的条件筛选及分组筛选
MySQL面试真题(二十二)——表连接后的条件筛选及分组筛选
2022-06-23 03:58:00 【Socialphobia_FOGO】
选出当日浏览房源10套以上并且注册超过一年的用户
某房源平台有两张表来记录用户信息、和用户查看房源信息。
用户表(用户号、用户注册时间)。
浏览表,字段有日志号,用户号,房源号,浏览日期。
问题:选出当日浏览房源10套以上并且注册超过一年的用户。、
结果如下:
#分析出当日浏览房源10套以上并且注册超过一年的用户
SELECT
浏览日期,
用户号,
COUNT(房源号) AS 房源数
FROM
浏览表 a
JOIN 用户表 b USING (用户号)
WHERE DATE_SUB(浏览日期, INTERVAL 1 YEAR) > 注册时间
GROUP BY 浏览日期,
用户号
HAVING COUNT(房源号) > 10
边栏推荐
- 树莓派assert初步使用练习
- Oracle异常
- 高等数学(第七版)同济大学 习题1-9 个人解答
- Mobile power fast charging qc3.0 scheme chip ip5318 fast charging scheme
- MySQL面试真题(三十)——贝壳-房产订单分析
- 英集芯推出4串锂电池100W移动电源升降压方案SoC芯片IP5389
- MCS: continuous random variable chi square distribution
- MySQL面试真题(二十三)——拼多多-球赛分析
- MySQL自定义序列数的实现
- 104. simple chat room 7: use socket to transfer objects
猜你喜欢

高等数学(第七版)同济大学 习题1-8 个人解答

Wechat applet: an artifact for calculating the full amount of orders

Win11不能录制音频怎么办?Win11无法录入声音的解决方法

英文字母pc是什么意思,互联网的pc指的是什么

FS4059A与FS5080E充电芯片的区别

visdom的使用

H5 adaptive full screen

sprintf 格式代码使用不规范在不同平台下的表现

What do Niu B programmers pay attention to when "creating an index"?

Yingjixin ip6806 wireless charging scheme 5W Qi certified peripheral simplified 14 devices
随机推荐
高等数学(第七版)同济大学 习题1-8 个人解答
Wechat applet: elderly blessing short video
Face recognition determination threshold
Go language -panic and recover
Introduction to MySQL (II) sub query + Association
云原生数据库是未来数据库的天下
Introduction to JDBC (III) implementation of transaction rollback function
Webrtc[47] - a common way for webrtc to save YUV data
fastjson中的@JSONField注解
Lottery DDD code
常用的无线充发射IC芯片
MCS: discrete random variable
Jsonfield annotation in fastjson
Differences between fs4059a and fs5080e charging chips
Array The from method creates an undefined array of length n
低成本5W无线充电器方案FS68001B简便充电芯片
MySQL面试真题(二十九)——案例-找到爱看的电影
Win software - (net framework) processed the certificate chain but terminated in a root certificate that is not trusted by the trusted provider
markdown给图片加背景色
Mobile power fast charging qc3.0 scheme chip ip5318 fast charging scheme