当前位置:网站首页>[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_id
anddirector_id
Must be the same to meet the conditions So we need to add two grouping conditions groupby. Because if the grouping condition is not addeddirector_id
thatCOUNT(*)
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
HAVING
Take out the desired group .SQL In the use ofHAVING
When 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;
边栏推荐
- tcp 解决short write问题
- idea快捷键 alt实现整列操作
- IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
- Oracle 19C OCP 1z0-082 certification examination question bank (13-18)
- [encryption weekly] has the encryption market recovered? The cold winter still hasn't thawed out. Take stock of the major events that occurred in the encryption market last week
- Hegong sky team vision training Day6 - traditional vision, image processing
- Oracle 19C OCP 1z0-083 question bank (7-12)
- Pytoch realizes logistic regression
- Uploading pictures on Alibaba cloud OSS
- Human computer interaction software based on C language
猜你喜欢
Vision Group Training Day5 - machine learning, image recognition project
Neo eco technology monthly | help developers play smart contracts
[untitled]
C Entry series (31) -- operator overloading
at、crontab
In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience
[eslint] Failed to load parser ‘@typescript-eslint/parser‘ declared in ‘package. json » eslint-confi
Day06 homework -- skill question 1
IC's first global hacking bonus is up to US $6million, helping developers venture into web 3!
pl/sql之集合
随机推荐
node的js文件引入
Cadence (x) wiring skills and precautions
Day 6 summary & database operation
Web概述和B/S架构
数据库操作 技能6
day06 作业--增删改查
Cve-2021-26295 Apache OFBiz deserialization Remote Code Execution Vulnerability recurrence
Dynamic SQL and exceptions of pl/sql
[freeswitch development practice] use SIP client Yate to connect freeswitch for VoIP calls
The effective condition of MySQL joint index and the invalid condition of index
ES6 modular import and export) (realize page nesting)
Pxe原理和概念
Uni app simple mall production
Form form
Study notes of automatic control principle -- correction and synthesis of automatic control system
Study notes of automatic control principle -- dynamic model of feedback control system
Cadence(十)走线技巧与注意事项
TCP solves the problem of short write
Poor English, Oracle OCP or MySQL OCP exam can also get a high score of 80 points
Learning notes of automatic control principle --- linear discrete system