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. [uart]3.tty驱动分析

    转自:http://www.wowotech.net/linux_kenrel/183.html 目录: 1 首先分析设备驱动的注册 1.1 uart_register_driver分析 1.2 tt ...

  2. nginx的centos和rhel的yum配置安装

    Official Red Hat/CentOS packages To add NGINX yum repository, create a file named /etc/yum.repos.d/n ...

  3. Hibernate基本原理(一)

    在开始学hibernate之前,一直就有人说:Hibernate并不难,无非是对JDBC进一步封装.一句不难,难道是真的不难还是眼高手低? 如果只是停留在使用的层面上,我相信什么技术都不难,看看别人怎 ...

  4. Windows与Linux下进程间通信技术比较

    一般我们写的程序都是以单个进程的方式来运行的,比较少涉及到多进程.特别是在windows下,因为Windows是按照线程来分配CPU时间片的,线程是最小的调度单位,所以在Windows下更多的用到多线 ...

  5. jQuery插件扩展方法

    jQuery为扩展插件提拱了两个方法,分别是: jQuery.extend(object) —— 给jQuery对象添加方法. jQuery.fn.extend(object) —— 为扩展jQuer ...

  6. 重复数据删除 开源实现 (deduputil) (转)

    [dedup util] dedup util是一款开源的轻量级文件打包工具,它基于块级的重复数据删除技术,可以有效缩减数据容量,节省用户存储空间.目前已经在Sourceforge上创建项目,并且源码 ...

  7. 关于Struts2的界面的摆放

    控件有的时候怎么放都感觉放不到自己想要的位置,这时候可以有这几个做法 1.用一个table标签来创建一个表格,再在表格里面一行一列地放,比较整齐 2.用表格,结果却发现有的控件位置莫名其妙,这时候就要 ...

  8. 在不指定特殊属性的情况下,哪几种HTML标签可以手动输入文本:()

    A. <TEXTAREA></TEXTAREA> B. <INPUT type=”text”/> C. <INPUT type=”hidden”/> D ...

  9. MODEL-View-Controller,既模型-视图-控制器

    Swing组件采用MVC(MODEL-View-Controller,既模型-视图-控制器)设计模式,其中模型(Model)用于维护组件的各种状态,视图(View)是组件的可视化表现,控制器(Cont ...

  10. ubuntu 系统网络突然"网络已禁用"

    sudo service network-manager stop  sudo rm /var/lib/NetworkManager/NetworkManager.state  sudo servic ...