{ "data": { "question": { "questionId": "1136", "questionFrontendId": "1050", "boundTopicId": null, "title": "Actors and Directors Who Cooperated At Least Three Times", "titleSlug": "actors-and-directors-who-cooperated-at-least-three-times", "content": "<p>Table: <code>ActorDirector</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| actor_id | int |\n| director_id | int |\n| timestamp | int |\n+-------------+---------+\ntimestamp is the primary key column for this table.\n</pre>\n\n<p> </p>\n\n<p>Write a SQL query for a report that provides the pairs <code>(actor_id, director_id)</code> where the actor has cooperated with the director at least three times.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The query result format is in the following example.</p>\n\n<p> </p>\n<p><strong>Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nActorDirector table:\n+-------------+-------------+-------------+\n| actor_id | director_id | timestamp |\n+-------------+-------------+-------------+\n| 1 | 1 | 0 |\n| 1 | 1 | 1 |\n| 1 | 1 | 2 |\n| 1 | 2 | 3 |\n| 1 | 2 | 4 |\n| 2 | 1 | 5 |\n| 2 | 1 | 6 |\n+-------------+-------------+-------------+\n<strong>Output:</strong> \n+-------------+-------------+\n| actor_id | director_id |\n+-------------+-------------+\n| 1 | 1 |\n+-------------+-------------+\n<strong>Explanation:</strong> The only pair is (1, 1) where they cooperated exactly 3 times.\n</pre>\n", "translatedTitle": null, "translatedContent": null, "isPaidOnly": false, "difficulty": "Easy", "likes": 124, "dislikes": 23, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\":{\"ActorDirector\":[\"actor_id\",\"director_id\",\"timestamp\"]},\"rows\":{\"ActorDirector\":[[1,1,0],[1,1,1],[1,1,2],[1,2,3],[1,2,4],[2,1,5],[2,1,6]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": [ { "lang": "MySQL", "langSlug": "mysql", "code": "# Write your MySQL query statement below\n", "__typename": "CodeSnippetNode" }, { "lang": "MS SQL Server", "langSlug": "mssql", "code": "/* Write your T-SQL query statement below */\n", "__typename": "CodeSnippetNode" }, { "lang": "Oracle", "langSlug": "oraclesql", "code": "/* Write your PL/SQL query statement below */\n", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"41.1K\", \"totalSubmission\": \"56.8K\", \"totalAcceptedRaw\": 41144, \"totalSubmissionRaw\": 56778, \"acRate\": \"72.5%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\":{\"ActorDirector\":[\"actor_id\",\"director_id\",\"timestamp\"]},\"rows\":{\"ActorDirector\":[[1,1,0],[1,1,1],[1,1,2],[1,2,3],[1,2,4],[2,1,5],[2,1,6]]}}", "metaData": "{\n \"mysql\": [\n \"Create table If Not Exists ActorDirector (actor_id int, director_id int, timestamp int)\"\n ],\n \"mssql\": [\n \"Create table ActorDirector (actor_id int, director_id int, timestamp int)\"\n ],\n \"oraclesql\": [\n \"Create table ActorDirector (actor_id int, director_id int, timestamp int)\"\n ],\n \"database\": true\n}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists ActorDirector (actor_id int, director_id int, timestamp int)", "Truncate table ActorDirector", "insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '1', '0')", "insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '1', '1')", "insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '1', '2')", "insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '2', '3')", "insert into ActorDirector (actor_id, director_id, timestamp) values ('1', '2', '4')", "insert into ActorDirector (actor_id, director_id, timestamp) values ('2', '1', '5')", "insert into ActorDirector (actor_id, director_id, timestamp) values ('2', '1', '6')" ], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"mysql\": [\"MySQL\", \"<p><code>MySQL 8.0</code>.</p>\"], \"mssql\": [\"MS SQL Server\", \"<p><code>mssql server 2019</code>.</p>\"], \"oraclesql\": [\"Oracle\", \"<p><code>Oracle Sql 11.2</code>.</p>\"]}", "libraryUrl": null, "adminUrl": null, "challengeQuestion": null, "__typename": "QuestionNode" } } }