Biggest Single Number - SQL
Biggest Single Number - SQL
naiborhujosua / !"#
$#%
%&'
()%$
*+,-
-
%./% !"#$
%
&
'(
)*+
,
/ Easy /
01
2.,-
3456Attempted 5 more today 72
8&(1
9
3contributor
1 -- Question 24
2 -- Table my_numbers contains many numbers in column num including duplicated ones.
3 -- Can you write a SQL query to find the biggest number, which only appears once.
4
5 -- +---+
6 -- |num|
7 -- +---+
8 -- | 8 |
9 -- | 8 |
10 -- | 3 |
11 -- | 3 |
12 -- | 1 |
13 -- | 4 |
14 -- | 5 |
15 -- | 6 |
16 -- For the sample data above, your query should return the following result:
17 -- +---+
18 -- |num|
19 -- +---+
20 -- | 6 |
21 -- Note:
22 -- If there is no such number, just output null.
23
24 -- Solution
25 Select max(a.num) as num
26 from
27 (
1 of 2 16/09/22, 12:10 am
SQL-Leetcode-Challenge/Biggest Single number.sql at master · naiborh... https://github.com/naiborhujosua/SQL-Leetcode-Challenge/blob/master...
2 of 2 16/09/22, 12:10 am