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

最新文章

  1. PHP Redis 全部操作方法
  2. NUC_HomeWork1 -- POJ2067(最短路)
  3. JavaScript权威指南(第六版)--JavaScript概述 DEMO
  4. Java方法
  5. 《TCP/IP具体解释卷2:实现》笔记--IP多播
  6. python邮件发送接收
  7. c# label的内容显示不全
  8. usaco 打扫食槽
  9. php下正则表达式整理
  10. 开发一个Swing功能时的一点总结
  11. GDI+ 应用,Release没有错误,Debug很多。
  12. PHP扩展开发 第一课 为什么要写扩展及hello world
  13. MoonLight可视化订单需求区域分析系统前端
  14. Cocos2D遍历场景图(Scene Graph)
  15. Flack--SQLAlchemy
  16. nginx 重定向 说明
  17. POJ 1094 Sorting It All Out 【拓扑排序】
  18. SpringBoot项目单元测试
  19. 图文转化(Alpha)版使用说明
  20. iml文件

热门文章

  1. 180714、JRebel插件安装配置与破解激活(多方案)详细教程
  2. Python----八荣八耻
  3. Windows的文件类型关联
  4. Entity Framework Core的贴心:优雅处理带默认值的数据库字段
  5. Ubuntu下eclipse中运行Hadoop时所需要的JRE与JDK的搭配
  6. TensorRT 不支持Tensorflow的操作有如下
  7. zookeeper集群扩容/下线节点实践
  8. windows共享文件分析
  9. [development][c++] C++构造函数调用构造函数
  10. Nand Flash 驱动框架