Table number contains many numbers in column num including duplicated ones.
Can you write a SQL query to find the biggest number, which only appears once.

+---+
|num|
+---+
| 8 |
| 8 |
| 3 |
| 3 |
| 1 |
| 4 |
| 5 |
| 6 |

For the sample data above, your query should return the following result:

+---+
|num|
+---+
| 6 |

Note:
If there is no such number, just output null.

Code

SELECT MAX(num) as num FROM (SELECT num FROM number GROUP BY num HAVING COUNT(num) = 1) AS t
# note : have to has AS t

[LeetCode] 619. Biggest Single Number_Easy tag: SQL的更多相关文章

  1. [LeetCode] 620. Not Boring Movies_Easy tag: SQL

    X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a ...

  2. [LeetCode] 176. Second Highest Salary_Easy tag: SQL

    Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...

  3. [LeetCode] 196. Delete Duplicate Emails_Easy tag: SQL

    Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique ...

  4. [LeetCode] 584. Find Customer Referee_Easy tag: SQL

    Given a table customer holding customers information and the referee. +------+------+-----------+ | ...

  5. [LeetCode] 603. Consecutive Available Seats_Easy tag: SQL

    Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you ...

  6. 【一天一道LeetCode】#260. Single Number III

    一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...

  7. [LeetCode] 64. Minimum Path Sum_Medium tag: Dynamic Programming

    Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which ...

  8. 【LeetCode】137. Single Number II 解题报告(Python)

    [LeetCode]137. Single Number II 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/problems/single- ...

  9. [LeetCode] 181. Employees Earning More Than Their Managers_Easy tag: SQL

    The Employee table holds all employees including their managers. Every employee has an Id, and there ...

随机推荐

  1. sshpass 配置密码登录ssh

    tar -zxvf sshpass-1.06.tar.gzcd sshpass-1.06./configuremake && make install sshpass -p userp ...

  2. python3安装PIL

    原创    2017-09-29 16:15:27 系统环境: 64位win10系统,同时安装python2.7与python3.6两个版本 安装: PIL是Python平台事实上的图像处理标准库,支 ...

  3. PHP基础语法 【】【】 PHP函数

    <?php //注释语法 /* 多行注释 */ //输出语法 echo "hello"; echo "world","dhakj"; ...

  4. d7

    小数据池:int -5~256str 特殊字符,*数字20 ascii : 8位 1字节 表示1个字符unicode 32位 4个字节 表示一个字符utf- 8 1个英文 8位,1个字节 欧洲 16位 ...

  5. hdu4300 Clairewd’s message【next数组应用】

    Clairewd’s message Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Other ...

  6. {python--GIL锁}一 介绍 二 GIL介绍 三 GIL与Lock 四 GIL与多线程 五 多线程性能测试

    python--GIL锁 GIL锁 本节目录 一 介绍 二 GIL介绍 三 GIL与Lock 四 GIL与多线程 五 多线程性能测试 一 背景知识 ''' 定义: In CPython, the gl ...

  7. Error:..\FreeRTOS\portable\RVDS\ARM_CM3\port.c,378 Error:..\FreeRTOS\portable\RVDS\ARM_CM3\port.c,378 Error:..\FreeRTOS\portable\RVDS\ARM_CM3\port.c,378 Error:..\FreeRTOS\tasks.c,2806

    Error:..\FreeRTOS\portable\RVDS\ARM_CM3\port.c,378Error:..\FreeRTOS\portable\RVDS\ARM_CM3\port.c,378 ...

  8. CCPC-Wannafly Winter Camp Day3 Div1 - 排列

    题目链接:https://zhixincode.com/contest/14/problem/A?problem_id=203 time limit per test: 1 secondmemory ...

  9. Elastic数据迁移方法及注意事项

    需求 ES集群Cluster_A里的数据(某个索引或某几个索引),需要迁移到另外一个ES集群Cluster_B中. 环境 Linux:Centos7 / Centos6.5/ Centos6.4Ela ...

  10. Search,look for,find,seek(找)用法

    舉個例子 ----> 你可以幫我找我的眼鏡嗎? SEARCH Search是仔細.徹底尋找/搜尋的意思. 比較少人會說 Can you help me search for my glasses ...