当前位置:网站首页>[leetcode database 1050] actors and directors who have cooperated at least three times (simple question)
[leetcode database 1050] actors and directors who have cooperated at least three times (simple question)
2022-07-26 08:56:00 【Evening scenery at the top of the mountain】
One 、 subject

Two 、 Code
- Because it requires the cooperation of actors and directors That is to say
actor_idanddirector_idMust be the same to meet the conditions So we need to add two grouping conditions groupby. Because if the grouping condition is not addeddirector_idthatCOUNT(*)What counts is the number of collaborations between the actor and all directors Rather than the number of collaborations with various directors In the fourth example of the test, there will be errors . - use GROUP BY After grouping, you can use
HAVINGTake out the desired group .SQL In the use ofHAVINGWhen clause SELECT The order of statements is :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;
边栏推荐
- Day06 operation -- addition, deletion, modification and query
- Form form
- 第6天总结&数据库作业
- Pop up window in Win 11 opens with a new tab ---firefox
- PHP page value transfer
- C # use npoi to operate Excel
- P3743 Kotori's equipment
- Solve the problem of C # calling form controls across threads
- 【加密周报】加密市场有所回温?寒冬仍未解冻 盘点上周加密市场发生的重大事件
- The idea shortcut key ALT realizes the whole column operation
猜你喜欢

Registration of finite element learning knowledge points

【搜索专题】看完必会的搜索问题之洪水覆盖

【数据库 】GBase 8a MPP Cluster V95 安装和卸载

The idea shortcut key ALT realizes the whole column operation

Set of pl/sql

Poor English, Oracle OCP or MySQL OCP exam can also get a high score of 80 points

My meeting of OA project (query)

Kotlin属性与字段

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

uni-app 简易商城制作
随机推荐
The effective condition of MySQL joint index and the invalid condition of index
解决C#跨线程调用窗体控件的问题
Datawhale panda book has been published!
2000年的教训。web3是否=第三次工业革命?
Oracle 19C OCP 1z0-082 certification examination question bank (51-60)
Cve-2021-26295 Apache OFBiz deserialization Remote Code Execution Vulnerability recurrence
keepalived双机热备
03异常处理,状态保持,请求钩子---04大型项目结构与蓝图
Okaleido launched the fusion mining mode, which is the only way for Oka to verify the current output
Uni app simple mall production
[freeswitch development practice] user defined module creation and use
Kept dual machine hot standby
Oracle 19C OCP 1z0-082 certification examination question bank (36-41)
Database operation topic 2
Transfer guide printing system based on C language design
Recurrence of SQL injection vulnerability in the foreground of a 60 terminal security management system
C#入门系列(三十一) -- 运算符重载
PXE principles and concepts
Form form
[recommended collection] MySQL 30000 word essence summary index (II) [easy to understand]