{ "data": { "question": { "questionId": "570", "questionFrontendId": "570", "boundTopicId": null, "title": "Managers with at Least 5 Direct Reports", "titleSlug": "managers-with-at-least-5-direct-reports", "content": null, "translatedTitle": null, "translatedContent": null, "isPaidOnly": true, "difficulty": "Medium", "likes": 220, "dislikes": 31, "isLiked": null, "similarQuestions": "[]", "exampleTestcases": "{\"headers\": {\"Employee\": [\"id\", \"name\", \"department\", \"managerId\"]}, \"rows\": {\"Employee\": [[101, \"John\", \"A\", null],[102, \"Dan\", \"A\", 101], [103, \"James\", \"A\", 101], [104, \"Amy\", \"A\", 101], [105, \"Anne\", \"A\", 101], [106, \"Ron\", \"B\", 101]]}}", "categoryTitle": "Database", "contributors": [], "topicTags": [ { "name": "Database", "slug": "database", "translatedName": null, "__typename": "TopicTagNode" } ], "companyTagStats": null, "codeSnippets": null, "stats": "{\"totalAccepted\": \"57.6K\", \"totalSubmission\": \"86K\", \"totalAcceptedRaw\": 57610, \"totalSubmissionRaw\": 86024, \"acRate\": \"67.0%\"}", "hints": [ "Try to get all the mangerIDs that have count bigger than 5", "Use the last hint's result as a table and do join with origin table at id equals to managerId", "This is a very good example to show the performance of SQL code. Try to work out other solutions and you may be surprised by running time difference.", "If your solution uses 'IN' function and runs more than 5 seconds, try to optimize it by using 'JOIN' instead." ], "solution": { "id": "209", "canSeeDetail": true, "paidOnly": false, "hasVideoSolution": false, "paidOnlyVideo": true, "__typename": "ArticleNode" }, "status": null, "sampleTestCase": "{\"headers\": {\"Employee\": [\"id\", \"name\", \"department\", \"managerId\"]}, \"rows\": {\"Employee\": [[101, \"John\", \"A\", null],[102, \"Dan\", \"A\", 101], [103, \"James\", \"A\", 101], [104, \"Amy\", \"A\", 101], [105, \"Anne\", \"A\", 101], [106, \"Ron\", \"B\", 101]]}}", "metaData": "{\n \"mysql\": [\n \"Create table If Not Exists Employee (id int, name varchar(255), department varchar(255), managerId int)\"\n ],\n \"mssql\": [\n \"Create table Employee (id int, name varchar(255), department varchar(255), managerId int)\"\n ],\n \"oraclesql\": [\n \"Create table Employee (id int, name varchar(255), department varchar(255), managerId int)\"\n ],\n \"database\": true\n}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists Employee (id int, name varchar(255), department varchar(255), managerId int)", "Truncate table Employee", "insert into Employee (id, name, department, managerId) values ('101', 'John', 'A', 'None')", "insert into Employee (id, name, department, managerId) values ('102', 'Dan', 'A', '101')", "insert into Employee (id, name, department, managerId) values ('103', 'James', 'A', '101')", "insert into Employee (id, name, department, managerId) values ('104', 'Amy', 'A', '101')", "insert into Employee (id, name, department, managerId) values ('105', 'Anne', 'A', '101')", "insert into Employee (id, name, department, managerId) values ('106', 'Ron', 'B', '101')" ], "enableRunCode": true, "enableTestMode": false, "enableDebugger": false, "envInfo": "{\"mysql\": [\"MySQL\", \"
MySQL 8.0
.
mssql server 2019
.
Oracle Sql 11.2
.