{ "data": { "question": { "questionId": "619", "questionFrontendId": "619", "categoryTitle": "Database", "boundTopicId": 2630, "title": "Biggest Single Number", "titleSlug": "biggest-single-number", "content": "

Table: MyNumbers

\n\n
\n+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| num         | int  |\n+-------------+------+\nThis table may contain duplicates (In other words, there is no primary key for this table in SQL).\nEach row of this table contains an integer.\n
\n\n

 

\n\n

A single number is a number that appeared only once in the MyNumbers table.

\n\n

Find the largest single number. If there is no single number, report null.

\n\n

The result format is in the following example.

\n \n

 

\n

Example 1:

\n\n
\nInput: \nMyNumbers table:\n+-----+\n| num |\n+-----+\n| 8   |\n| 8   |\n| 3   |\n| 3   |\n| 1   |\n| 4   |\n| 5   |\n| 6   |\n+-----+\nOutput: \n+-----+\n| num |\n+-----+\n| 6   |\n+-----+\nExplanation: The single numbers are 1, 4, 5, and 6.\nSince 6 is the largest single number, we return it.\n
\n\n

Example 2:

\n\n
\nInput: \nMyNumbers table:\n+-----+\n| num |\n+-----+\n| 8   |\n| 8   |\n| 7   |\n| 7   |\n| 3   |\n| 3   |\n| 3   |\n+-----+\nOutput: \n+------+\n| num  |\n+------+\n| null |\n+------+\nExplanation: There are no single numbers in the input table so we return null.\n
\n", "translatedTitle": "只出现一次的最大数字", "translatedContent": "

MyNumbers 表:

\n\n
\n
\n
\n+-------------+------+\n| Column Name | Type |\n+-------------+------+\n| num         | int  |\n+-------------+------+\n该表可能包含重复项(换句话说,在SQL中,该表没有主键)。\n这张表的每一行都含有一个整数。\n
\n\n

 

\n\n

单一数字 是在 MyNumbers 表中只出现一次的数字。

\n\n

找出最大的 单一数字 。如果不存在 单一数字 ,则返回 null

\n\n

查询结果如下例所示。

\n \n\n

 

\n\n

示例 1:

\n\n
\n输入:\nMyNumbers 表:\n+-----+\n| num |\n+-----+\n| 8   |\n| 8   |\n| 3   |\n| 3   |\n| 1   |\n| 4   |\n| 5   |\n| 6   |\n+-----+\n输出:\n+-----+\n| num |\n+-----+\n| 6   |\n+-----+\n解释:单一数字有 1、4、5 和 6 。\n6 是最大的单一数字,返回 6 。\n
\n\n

示例 2:

\n\n
\n输入:\nMyNumbers table:\n+-----+\n| num |\n+-----+\n| 8   |\n| 8   |\n| 7   |\n| 7   |\n| 3   |\n| 3   |\n| 3   |\n+-----+\n输出:\n+------+\n| num  |\n+------+\n| null |\n+------+\n解释:输入的表中不存在单一数字,所以返回 null 。\n
\n
\n
\n\n

 

\n", "isPaidOnly": false, "difficulty": "Easy", "likes": 90, "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 biggest_single_number(my_numbers: pd.DataFrame) -> pd.DataFrame:\n ", "__typename": "CodeSnippetNode" }, { "lang": "PostgreSQL", "langSlug": "postgresql", "code": "-- Write your PostgreSQL query statement below", "__typename": "CodeSnippetNode" } ], "stats": "{\"totalAccepted\": \"45.2K\", \"totalSubmission\": \"87.2K\", \"totalAcceptedRaw\": 45202, \"totalSubmissionRaw\": 87170, \"acRate\": \"51.9%\"}", "hints": [], "solution": null, "status": null, "sampleTestCase": "{\"headers\": {\"MyNumbers\": [\"num\"]}, \"rows\": {\"MyNumbers\": [[8],[8],[3],[3],[1],[4],[5],[6]]}}", "metaData": "{\"mysql\":[\"Create table If Not Exists MyNumbers (num int)\"],\"mssql\":[\"Create table MyNumbers (num int)\"],\"oraclesql\":[\"Create table MyNumbers (num int)\"],\"database\":true,\"name\":\"biggest_single_number\",\"pythondata\":[\"MyNumbers = pd.DataFrame([], columns=['num']).astype({'num':'Int64'})\"],\"postgresql\":[\"Create table If Not Exists MyNumbers (num int)\"],\"database_schema\":{\"MyNumbers\":{\"num\":\"INT\"}}}", "judgerAvailable": true, "judgeType": "large", "mysqlSchemas": [ "Create table If Not Exists MyNumbers (num int)", "Truncate table MyNumbers", "insert into MyNumbers (num) values ('8')", "insert into MyNumbers (num) values ('8')", "insert into MyNumbers (num) values ('3')", "insert into MyNumbers (num) values ('3')", "insert into MyNumbers (num) values ('1')", "insert into MyNumbers (num) values ('4')", "insert into MyNumbers (num) values ('5')", "insert into MyNumbers (num) values ('6')" ], "enableRunCode": true, "envInfo": "{\"mysql\":[\"MySQL\",\"

\\u7248\\u672c\\uff1aMySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"

mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"

Oracle Sql 11.2.<\\/p>\"],\"pythondata\":[\"Pandas\",\"

Python 3.10 with Pandas 2.0.2 and NumPy 1.25.0<\\/p>\"],\"postgresql\":[\"PostgreSQL\",\"

PostgreSQL 16<\\/p>\"]}", "book": null, "isSubscribed": false, "isDailyQuestion": false, "dailyRecordStatus": null, "editorType": "CKEDITOR", "ugcQuestionId": null, "style": "LEETCODE", "exampleTestcases": "{\"headers\": {\"MyNumbers\": [\"num\"]}, \"rows\": {\"MyNumbers\": [[8],[8],[3],[3],[1],[4],[5],[6]]}}\n{\"headers\": {\"MyNumbers\": [\"num\"]}, \"rows\": {\"MyNumbers\": [[8],[8],[7],[7],[3],[3],[3]]}}", "__typename": "QuestionNode" } } }