10000 solved Biggest Single Number problem · Shubham-Bhoite/LeetCode-MySql@ff09abb · GitHub
[go: up one dir, main page]

Skip to content

Commit ff09abb

Browse files
solved Biggest Single Number problem
1 parent edf9431 commit ff09abb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Solutions/Problem-24.sql

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* 24.Biggest Single Number :
2+
3+
Table: MyNumbers
4+
+-------------+------+
5+
| Column Name | Type |
6+
+-------------+------+
7+
| num | int |
8+
+-------------+------+
9+
This table may contain duplicates (In other words, there is no primary key for this table in SQL).
10+
Each row of this table contains an integer.
11+
12+
A single number is a number that appeared only once in the MyNumbers table.
13+
Find the largest single number. If there is no single number, report null.
14+
*/
15+
16+
SELECT MAX(num) AS num
17+
FROM (
18+
SELECT num
19+
FROM MyNumbers
20+
GROUP BY num
21+
HAVING COUNT(num) = 1)
22+
AS single_numbers;

0 commit comments

Comments
 (0)
0