当前位置:网站首页>【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;
边栏推荐
- Set of pl/sql
- Replication of SQL injection vulnerability in the foreground of Pan micro e-cology8
- Poor English, Oracle OCP or MySQL OCP exam can also get a high score of 80 points
- Mycat2 sub database and sub table
- [recommended collection] MySQL 30000 word essence summary - query and transaction (III)
- Ansible important components (playbook)
- Foundry教程:使用多种方式编写可升级的智能合约(上)
- Web3 Games: current situation and future
- JDBC数据库连接池(Druid技术)
- Typescript snowflake primary key generator
猜你喜欢

解决C#跨线程调用窗体控件的问题

JDBC数据库连接池(Druid技术)

Super potential public chain dfinity -- the best time for DFI developers to enter

Media at home and abroad publicize that we should strictly grasp the content
![[database] gbase 8A MPP cluster v95 installation and uninstall](/img/56/c0dae30ba608842c1b92e914ef42fe.png)
[database] gbase 8A MPP cluster v95 installation and uninstall

有限元学习知识点备案

Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式

Hegong sky team vision training Day6 - traditional vision, image processing

KV database based on raft consensus protocol

Using the primitive root of module m to judge and solve
随机推荐
Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output
合工大苍穹战队视觉组培训Day5——机器学习,图像识别项目
1、 Redis data structure
SSH,NFS,FTP
Pxe原理和概念
Human computer interaction software based on C language
Typescript encryption tool passwordencoder
Kotlin属性与字段
Redis advanced
Set of pl/sql -2
【搜索专题】看完必会的搜索问题之洪水覆盖
Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
Ueditot_ JSP SSRF vulnerability recurrence
Regular expression: judge whether it conforms to USD format
【加密周报】加密市场有所回温?寒冬仍未解冻 盘点上周加密市场发生的重大事件
Mysql8 one master one slave +mycat2 read write separation
Media at home and abroad publicize that we should strictly grasp the content
Mysql database connection / query index and other common syntax
23.9 application exit application exit
基于C语言的哈夫曼转化软件