[LeetCode] 584. Find Customer Referee_Easy tag: SQL
Given a table customer holding customers information and the referee.
+------+------+-----------+
| id | name | referee_id|
+------+------+-----------+
| 1 | Will | NULL |
| 2 | Jane | NULL |
| 3 | Alex | 2 |
| 4 | Bill | NULL |
| 5 | Zack | 1 |
| 6 | Mark | 2 |
+------+------+-----------+
Write a query to return the list of customers NOT referred by the person with id '2'.
For the sample data above, the result is:
+------+
| name |
+------+
| Will |
| Jane |
| Bill |
| Zack |
+------+
note: 要用 is Null 和 != .
Code
SELECT name FROM customer WHERE referee_id != 2 OR referee_id IS NULL
[LeetCode] 584. Find Customer Referee_Easy tag: SQL的更多相关文章
- [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 ...
- [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] 603. Consecutive Available Seats_Easy tag: SQL
Several friends at a cinema ticket office would like to reserve consecutive available seats.Can you ...
- [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] 586. Customer Placing the Largest Number of Orders_Easy tag;SQL
Query the customer_number from the orders table for the customer who has placed the largest number o ...
- [LeetCode] 607. Sales Person_Easy tag: SQL
Description Given three tables: salesperson, company, orders.Output all the names in the table sales ...
- [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 ...
随机推荐
- css3---2D效果 ---3D效果
CSS3边框: CSS3圆角:border-radius(**px 或 **%) 属性——创建边框线的圆角 CSS3盒子阴影:box-shadow属性——创建阴影 box-shadow:30px 0p ...
- easyui---form表单_validatebox验证框
第一种方式:混合写法 $("#password").validatebox({ }) <td><input type="text" name= ...
- Please check logcat output for more details
Please check logcat output for more details 小米第一次可以安装,后面就不行了,研究发现 手机里面有同名的apk,直接elipse重命名 就可以了. 小米us ...
- [No0000108]Git1/9-Git简介与入门
Git是什么? Git是目前世界上最先进的分布式版本控制系统(没有之一). Git有什么特点?简单来说就是:高端大气上档次! 那什么是版本控制系统? 如果你用Microsoft Word写过长篇大论, ...
- Mac操作的一些技能
截图功能 通常会用到以下快捷键组合: Command+Shift+3截全屏. Command+Shift+4截屏幕选定部分. Command+Shift+4+空格截取所选窗口 在终端输入如下命令,开启 ...
- 写一个表达式检查所给的整数是否它第三个数字(从右向左)是7。示例:1732 -> true。
在学习C#基础部分(课件来源:http://www.xuepub.com/52.html),遇到这么一个题目,前段时间面试遇到一个"车牌限行的问题",我就在想如何取末尾数值的问题. ...
- android gradle jnilibs
https://blog.csdn.net/xx326664162/article/details/51167849 [ABIXCPU] Android jniLibs下目录详解(.so文件) htt ...
- nvm npm node
npm init/install 语义版本号分为X.Y.Z三位,分别代表主版本号.次版本号和补丁版本号.当代码变更时,版本号按以下原则更新. 如果只是修复bug,需要更新Z位. 如果是新增了功能,但是 ...
- post/get in console of JSarray/js 数组详细操作方法及解析合集
https://juejin.im/post/5b0903b26fb9a07a9d70c7e0[ js 数组详细操作方法及解析合集 js array and for each https://blog ...
- kafka实战读书笔记
1.katka_2.12-l.0.0.tgz 上面两个文件中的 2.11 /2.12 分别表示编译 Kafka 的 Scala 语言版本,后面的 1.0 .0 是 Kafka的版本 . 2.kafka ...