1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/originData/classes-more-than-5-students.json
2023-12-09 19:57:46 +08:00

96 lines
8.6 KiB
JSON
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"data": {
"question": {
"questionId": "596",
"questionFrontendId": "596",
"categoryTitle": "Database",
"boundTopicId": 1418,
"title": "Classes More Than 5 Students",
"titleSlug": "classes-more-than-5-students",
"content": "<p>Table: <code>Courses</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| student | varchar |\n| class | varchar |\n+-------------+---------+\n(student, class) is the primary key (combination of columns with unique values) for this table.\nEach row of this table indicates the name of a student and the class in which they are enrolled.\n</pre>\n\n<p>&nbsp;</p>\n\n<p>Write a solution to find all the classes that have <strong>at least five students</strong>.</p>\n\n<p>Return the result table in <strong>any order</strong>.</p>\n\n<p>The&nbsp;result format is in the following example.</p>\n\n<p>&nbsp;</p>\n<p><strong class=\"example\">Example 1:</strong></p>\n\n<pre>\n<strong>Input:</strong> \nCourses table:\n+---------+----------+\n| student | class |\n+---------+----------+\n| A | Math |\n| B | English |\n| C | Math |\n| D | Biology |\n| E | Math |\n| F | Computer |\n| G | Math |\n| H | Math |\n| I | Math |\n+---------+----------+\n<strong>Output:</strong> \n+---------+\n| class |\n+---------+\n| Math |\n+---------+\n<strong>Explanation:</strong> \n- Math has 6 students, so we include it.\n- English has 1 student, so we do not include it.\n- Biology has 1 student, so we do not include it.\n- Computer has 1 student, so we do not include it.\n</pre>\n",
"translatedTitle": "超过5名学生的课",
"translatedContent": "<p>表:&nbsp;<code>Courses</code></p>\n\n<pre>\n+-------------+---------+\n| Column Name | Type |\n+-------------+---------+\n| student | varchar |\n| class | varchar |\n+-------------+---------+\n在 SQL 中,(student, class)是该表的主键列。\n该表的每一行表示学生的名字和他们注册的班级。\n</pre>\n\n<p>&nbsp;</p>\n\n<p>查询&nbsp;<strong>至少有5个学生</strong> 的所有班级。</p>\n\n<p>以 <strong>任意顺序 </strong>返回结果表。</p>\n\n<p>查询结果格式如下所示。</p>\n\n<p>&nbsp;</p>\n\n<p><strong>示例 1:</strong></p>\n\n<pre>\n<strong>输入:</strong> \nCourses table:\n+---------+----------+\n| student | class |\n+---------+----------+\n| A | Math |\n| B | English |\n| C | Math |\n| D | Biology |\n| E | Math |\n| F | Computer |\n| G | Math |\n| H | Math |\n| I | Math |\n+---------+----------+\n<strong>输出:</strong> \n+---------+ \n| class &nbsp; | \n+---------+ \n| Math &nbsp; &nbsp;| \n+---------+\n<strong>解释: </strong>\n-数学课有6个学生所以我们包括它。\n-英语课有1名学生所以我们不包括它。\n-生物课有1名学生所以我们不包括它。\n-计算机课有1个学生所以我们不包括它。</pre>\n",
"isPaidOnly": false,
"difficulty": "Easy",
"likes": 328,
"dislikes": 0,
"isLiked": null,
"similarQuestions": "[]",
"contributors": [],
"langToValidPlayground": "{\"cpp\": false, \"java\": false, \"python\": false, \"python3\": false, \"mysql\": false, \"mssql\": false, \"oraclesql\": false, \"c\": false, \"csharp\": false, \"javascript\": false, \"typescript\": false, \"bash\": false, \"php\": false, \"swift\": false, \"kotlin\": false, \"dart\": false, \"golang\": false, \"ruby\": false, \"scala\": false, \"html\": false, \"pythonml\": false, \"rust\": false, \"racket\": false, \"erlang\": false, \"elixir\": false, \"pythondata\": false, \"react\": false, \"vanillajs\": false, \"postgresql\": false}",
"topicTags": [
{
"name": "Database",
"slug": "database",
"translatedName": "数据库",
"__typename": "TopicTagNode"
}
],
"companyTagStats": null,
"codeSnippets": [
{
"lang": "MySQL",
"langSlug": "mysql",
"code": "# Write your MySQL query statement below",
"__typename": "CodeSnippetNode"
},
{
"lang": "MS SQL Server",
"langSlug": "mssql",
"code": "/* Write your T-SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Oracle",
"langSlug": "oraclesql",
"code": "/* Write your PL/SQL query statement below */",
"__typename": "CodeSnippetNode"
},
{
"lang": "Pandas",
"langSlug": "pythondata",
"code": "import pandas as pd\n\ndef find_classes(courses: pd.DataFrame) -> pd.DataFrame:\n ",
"__typename": "CodeSnippetNode"
},
{
"lang": "PostgreSQL",
"langSlug": "postgresql",
"code": "-- Write your PostgreSQL query statement below",
"__typename": "CodeSnippetNode"
}
],
"stats": "{\"totalAccepted\": \"169.3K\", \"totalSubmission\": \"323.6K\", \"totalAcceptedRaw\": 169281, \"totalSubmissionRaw\": 323616, \"acRate\": \"52.3%\"}",
"hints": [],
"solution": null,
"status": null,
"sampleTestCase": "{\"headers\": {\"Courses\": [\"student\", \"class\"]}, \"rows\": {\"Courses\": [[\"A\", \"Math\"], [\"B\", \"English\"], [\"C\", \"Math\"], [\"D\", \"Biology\"], [\"E\", \"Math\"], [\"F\", \"Computer\"], [\"G\", \"Math\"], [\"H\", \"Math\"], [\"I\", \"Math\"]]}}",
"metaData": "{\"mysql\":[\"Create table If Not Exists Courses (student varchar(255), class varchar(255))\"],\"mssql\":[\"Create table Courses (student varchar(255), class varchar(255))\"],\"oraclesql\":[\"Create table Courses (student varchar(255), class varchar(255))\"],\"database\":true,\"name\":\"find_classes\",\"pythondata\":[\"Courses = pd.DataFrame([], columns=['student', 'class']).astype({'student':'object', 'class':'object'})\"],\"postgresql\":[\"Create table If Not Exists Courses (student varchar(255), class varchar(255))\"],\"database_schema\":{\"Courses\":{\"student\":\"VARCHAR(255)\",\"class\":\"VARCHAR(255)\"}}}",
"judgerAvailable": true,
"judgeType": "large",
"mysqlSchemas": [
"Create table If Not Exists Courses (student varchar(255), class varchar(255))",
"Truncate table Courses",
"insert into Courses (student, class) values ('A', 'Math')",
"insert into Courses (student, class) values ('B', 'English')",
"insert into Courses (student, class) values ('C', 'Math')",
"insert into Courses (student, class) values ('D', 'Biology')",
"insert into Courses (student, class) values ('E', 'Math')",
"insert into Courses (student, class) values ('F', 'Computer')",
"insert into Courses (student, class) values ('G', 'Math')",
"insert into Courses (student, class) values ('H', 'Math')",
"insert into Courses (student, class) values ('I', 'Math')"
],
"enableRunCode": true,
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"<p>Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"<p>PostgreSQL 16<\\/p>\"]}",
"book": null,
"isSubscribed": false,
"isDailyQuestion": false,
"dailyRecordStatus": null,
"editorType": "CKEDITOR",
"ugcQuestionId": null,
"style": "LEETCODE",
"exampleTestcases": "{\"headers\": {\"Courses\": [\"student\", \"class\"]}, \"rows\": {\"Courses\": [[\"A\", \"Math\"], [\"B\", \"English\"], [\"C\", \"Math\"], [\"D\", \"Biology\"], [\"E\", \"Math\"], [\"F\", \"Computer\"], [\"G\", \"Math\"], [\"H\", \"Math\"], [\"I\", \"Math\"]]}}",
"__typename": "QuestionNode"
}
}
}