当前位置:网站首页>【LeetCode数据库1050】合作过至少三次的演员和导演(简单题)
【LeetCode数据库1050】合作过至少三次的演员和导演(简单题)
2022-07-26 08:47:00 【山顶夕景】
一、题目

二、代码
- 因为是要演员和导演合作的 也就是
actor_id和director_id必须都相同才满足条件 所以要加两个分组条件进行groupby。 因为如果分组条件不加director_id那么COUNT(*)计数的是该演员和所有导演的合作次数 而不是和各个导演的合作次数 在测试的第四个例子就会出错。 - 用GROUP BY分组后可以用
HAVING取出想要的组。SQL在使用HAVING子句时 SELECT 语句的顺序为:FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY。
# Write your MySQL query statement below
SELECT actor_id, director_id
FROM ActorDirector
GROUP BY actor_id, director_id
HAVING COUNT(*) >= 3;
边栏推荐
- 合工大苍穹战队视觉组培训Day5——机器学习,图像识别项目
- 数据库操作 题目一
- General file upload vulnerability getshell of a digital campus system (penetration test -0day)
- 【FreeSwitch开发实践】使用SIP客户端Yate连接FreeSwitch进行VoIP通话
- 2000年的教训。web3是否=第三次工业革命?
- In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience
- tcp 解决short write问题
- Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
- [recommended collection] MySQL 30000 word essence summary + 100 interview questions (I)
- 03 exception handling, state keeping, request hook -- 04 large project structure and blueprint
猜你喜欢
随机推荐
pl/sql之集合-2
After MySQL 8 OCP (1z0-908), hand in your homework
Cve-2021-21975 VMware SSRF vulnerability recurrence
Which financial product has the highest yield in 2022?
数据库操作 题目二
Study notes of automatic control principle -- dynamic model of feedback control system
Using the primitive root of module m to judge and solve
Hegong sky team vision training Day6 - traditional vision, image processing
Xtrabackup appears' flush no '_ WRITE_ TO_ BINLOG TABLES‘: 1205 (HY000) Lock wait timeout exceeded;
Maximum common substring & regularity problem
day06 作业--技能题2
Mysql8 one master one slave +mycat2 read write separation
day06 作业---技能题7
Foundry教程:使用多种方式编写可升级的智能合约(上)
Does flinkcdc now support sqlserver instance name connection?
P1825 [USACO11OPEN]Corn Maze S
数据库操作 技能6
【搜索专题】看完必会的搜索问题之洪水覆盖
Web概述和B/S架构
Oracle 19C OCP 1z0-082 certification examination question bank (51-60)








