Description:

Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL query to find all customers who never order anything

一种比较高效的方法是左连接,左连接之后任然使用被连接的两个表或多个表来定位连接之后的表的数据。

# Write your MySQL query statement below
select Name
from (Customers c left join Orders o on c.Id=o.CustomerId)
where o.Id is null;

LeetCode - Customers Who Never Order的更多相关文章

  1. [LeetCode] Customers Who Never Order 从未下单订购的顾客

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  2. LeetCode——Customers Who Never Order(灵活使用NOT IN以及IN)

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  3. [SQL]LeetCode183. 从不订购的客户 | Customers Who Never Order

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  4. LeetCode:Binary Tree Level Order Traversal I II

    LeetCode:Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of ...

  5. LeeCode(Database)-Customers Who Never Order

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  6. 【SQL】183. Customers Who Never Order

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  7. 183. Customers Who Never Order

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

  8. DataBase -- Customers Who Never Order

    Question: Suppose that a website contains two tables, the Customers table and the Orders table. Writ ...

  9. Customers Who Never Order

    Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...

随机推荐

  1. Jackson2.1.4 序列化对象时对属性的过滤

    //对field(所有字段)进行过滤 //对get方法进行过滤 //对isBoolean这样的方法进行过滤 //里面的具体配置有 ANY,DEFAULT,NON_PRIVATE,NONE,PROTEC ...

  2. Zookeeper配置文件参数与含义

    zoo.cfg   # The number of milliseconds of each tick tickTime=2000 # The number of ticks that the ini ...

  3. 如何去掉drwxr-xr-x@中的@符号Linux文件扩展信息

    如何去掉drwxr-xr-x@中的@符号Linux文件扩展信息ls -lart drwxrwxrwx@ 10 rlanffy staff 340B 3 6 2015 files-rwxrwxrwx@ ...

  4. [转]ListView学习笔记(二)——ViewHolder

    在android开发中Listview是一个很重要的组件,它以列表的形式根据数据的长自适应展示具体内容,用户可以自由的定义listview每一列的布局,但当listview有大量的数据需要加载的时候, ...

  5. rails中render 和 redirect_to的区别, each只能用在数组中,如果只有一个或者零个项,用each方法会报错undefined method `each' for #...

    在render中,即使有:action,那么也仅仅是取对应的view中的模板(html.erb)而已,所以这里即使浏览器中的url是/orders/xcreate,但是显示的界面是/app/views ...

  6. http://www.casualarena.com/

    http://www.casualarena.com/ ———————————————————————————————————————————— 包括祖玛.台球.国际象棋等双人联机小游戏.

  7. tomcat:run和tomcat7:run的区别,以及Apache Tomcat Maven Plugin 相关

    起因: 同事部署的maven项目,之前使用 jetty,现在切换到 tomcat,但是他使用的命令是 tomcat:run ,而不是 tomcat7:run,能启动,但出现问题了. 于是搜索了一番,想 ...

  8. Linux中vi的使用

    首先,如果vi中出现了方向键变成ABCD的情况,需要卸载默认的vim-common,再安装vim. sudo apt-get remove vim-common sudo apt-get instal ...

  9. js 补零方法,如果不足位数

    var pad = function() { var tbl = []; return function(num, n) { var len = n-num.toString().length; if ...

  10. 【Java NIO的深入研究5】字符集Charset

    Java 语言被定义为基于Unicode.一个字符实体由二个字节表示(如果是用UCS-2).但众多文件和数据流都是基于其它字符编码并以byte传输,操作文件内容就成了一个问题. 操作一个文件首先要对文 ...