LeetCode题解(1398):购买了产品A和产品B却没有购买产品C的顾客(SQL)
发布日期:2021-06-29 20:12:05
浏览次数:2
分类:技术文章
本文共 348 字,大约阅读时间需要 1 分钟。
题目:(中等)
标签:SQL
解法 | 时间复杂度 | 空间复杂度 | 执行用时 |
---|---|---|---|
Ans 1 (Python) | 535ms (8.65%) | ||
Ans 2 (Python) | |||
Ans 3 (Python) |
解法一:
SELECT O.customer_id, C.customer_nameFROM Orders AS O LEFT JOIN Customers C on O.customer_id = C.customer_idGROUP BY customer_idHAVING SUM(product_name = 'A') > 0 AND SUM(product_name = 'B') > 0 AND SUM(product_name = 'C') = 0;
转载地址:https://dataartist.blog.csdn.net/article/details/110423162 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
路过按个爪印,很不错,赞一个!
[***.219.124.196]2024年04月22日 08时46分32秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
第12章 Nib Files and NSWindowController
2019-04-30
第13章 User Defaults
2019-04-30
第14章 Using Notifications
2019-04-30
第17章 custom views
2019-04-30
第18章 Images and Mouse Events
2019-04-30
第21章 Pasteboards and Nil-Targeted Actions
2019-04-30
第22章 Categories
2019-04-30
第24章 NSTimer
2019-04-30
第26章 Creating NSFormatters
2019-04-30
第29章 View Swapping
2019-04-30
iphone开发学习资源
2019-04-30
第2章 Model View Controller
2019-04-30
“老外学中文“-开发进度
2019-04-30
我的mac pro,今后我们要一起加油啦!
2019-04-30
Huffman编码
2019-04-30
多台上网设备出现上网卡问题
2019-04-30
独立游戏市场营销策略:社交营销篇
2019-04-30
在cocos2d里面如何拖拽精灵
2019-04-30
UI界面设计标准,包括iPad mini和iPhone5。
2019-04-30