[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 ...
随机推荐
- ERP项目实施记录05
周四继续进行流程演练,把第一个销售订单的物料给领了出来,走完了"物流". 关于运用一个新系统大概会经历以下阶段: 未知--了解--熟悉--改善--依赖 未知:有期待.担心.抗拒,需 ...
- 洛谷P1147 连续自然数和【二分】
题目:https://www.luogu.org/problemnew/show/P1147 题意: 给定一个数m,问有多少个数对$(i,j)$,使得$i$到$j$区间的所有整数之和为m.输出所有的解 ...
- 洛谷 P1223排队接水【贪心】
题目描述 有n个人在一个水龙头前排队接水,假如每个人接水的时间为Ti,请编程找出这n个人排队的一种顺序,使得n个人的平均等待时间最小. 输入输出格式 输入格式: 输入文件共两行,第一行为n:第二行分别 ...
- JMeter结果树响应数据中文乱码解决办法
encoding编码 打开apache-jmeter-2.11\bin\jmeter.properties文件,搜索“encoding”关键字,找到如下配置: # The encoding to be ...
- 蓝桥杯 入门训练 Fibonacci数列 解析
问题描述 Fibonacci数列的递推公式为:Fn=Fn-1+Fn-2,其中F1=F2=1. 当n比较大时,Fn也非常大,现在我们想知道,Fn除以10007的余数是多少. 输入格式 输入包含一个整数n ...
- [No0000BE]控制台切换字符格式&Code Page Identifiers
cmd chcp命令切换字符格式 命令介绍: chcp 65001 #换成utf-8代码页 chcp 936 #换成默认的gbk chcp 437 #美国英语 一般默认为gbk,若要修改成 utf-8 ...
- 列表的pop()和路径拼接问题
我竟然发现了新大陆,感觉对列表已经啥也不清楚了 #pop()删除最后一项 l=[1,2,3] a=l.pop(-1) print(a) print(l) 结果: 3 [1, 2] 练习题:计算文件夹的 ...
- [DPDK] 转发 DPDK分析
前半部分,对于背景和需求的分析,写的相当好啊! 原文地址:https://www.jianshu.com/p/0ff8cb4deaef 背景分析 前10年中,网络程序性能优化的目标主要是为了解决C10 ...
- TFA(Trace File Analyzer)的安装与使用(ORACLE版本12C)
TFA是Oracle从11.2版本开始推出的一种类似diagcollection的一个oracle 集群日志收集器,而且TFA比diagcollection集中和自动化的诊断信息收集能力更强大.TFA ...
- StringDemo
package cn.sasa.demo2; public class StringDemo { public static void main(String[] args) { //String 底 ...