[LeetCode] 619. Biggest Single Number_Easy tag: SQL
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的更多相关文章
- [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 ...
- [LeetCode] 176. Second Highest Salary_Easy tag: SQL
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- [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 ...
- [LeetCode] 584. Find Customer Referee_Easy tag: SQL
Given a table customer holding customers information and the referee. +------+------+-----------+ | ...
- [LeetCode] 603. Consecutive Available Seats_Easy tag: SQL
Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you ...
- 【一天一道LeetCode】#260. Single Number III
一天一道LeetCode 本系列文章已全部上传至我的github,地址:ZeeCoder's Github 欢迎大家关注我的新浪微博,我的新浪微博 欢迎转载,转载请注明出处 (一)题目 Given a ...
- [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 ...
- 【LeetCode】137. Single Number II 解题报告(Python)
[LeetCode]137. Single Number II 解题报告(Python) 标签: LeetCode 题目地址:https://leetcode.com/problems/single- ...
- [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 ...
随机推荐
- AJAX里使用的弹窗样式 tanchuang.js tanchuang.css
tanchuang.js // 每个弹窗的标识 var x =0; var idzt = new Array(); var Window = function(config){ //ID不重复 idz ...
- mysql日期格式转换,如何保持原日期?CONVERT/Substring 函数截取。replace替换
http://www.cnblogs.com/stevenjson/p/3729577.html CONVERT(varchar(100), getdate(), 112)这种, 问题就出在getda ...
- HDU 1166 - 敌兵布阵 - [分块]
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166 题解: 本题作为一个模板题,我用它来检验过总查询时间复杂度为 $O(q \log n)$ 的树状 ...
- 【数论】Prime Time UVA - 10200 大素数 Miller Robin 模板
题意:验证1~10000 的数 n^n+n+41 中素数的个数.每个询问给出a,b 求区间[a,b]中质数出现的比例,保留两位 题解:质数会爆到1e8 所以用miller robin , 另外一个优 ...
- C和C指针小记(十二)-函数的可变参数表
1.可变参数表是通过宏实现的 宏定义于stdarg.h头文件,它是标准库的一部分.这个头文件声明了一个类型var_list和三个宏--va_start.va_arg.va_end. 我们可以声明一个类 ...
- .net WebService的使用
1. WebService可单独作为一个网站,不限平台的被调用. 2. 打开VS,选择新建 3. [WebMethod] 方法上面有这个说明,则表示此方法可被外部调用. 我们添加4个方法:加.减.乘. ...
- python-多线程等概念
并发 & 并行 并发:是指系统具有处理多个任务的能力 并行:是指系统具有 同时 处理多个任务的能力 并行 是 并发的一个子集 同步 & 异步 同步:当进程执行到一个I/O(等待外部数 ...
- php性能提升与检测
1.使用xhprof分析器检测性能各种消耗 2.php-fpm中进程池的配置参数查看最大进程数.进程最大处理http请求量.进程时间过多的http请求.每个进程使用的最大内存. 参考地址:https: ...
- [others]tinycore/microcore
https://zh.wikipedia.org/wiki/Tiny_Core_Linux https://github.com/zeit/micro
- mysql学习【第3篇】:使用DQL查询数据
狂神声明 : 文章均为自己的学习笔记 , 转载一定注明出处 ; 编辑不易 , 防君子不防小人~共勉 ! mysql学习[第3篇]:使用DQL查询数据 DQL语言 DQL( Data Query Lan ...