博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
leetcode 183. Customers Who Never Order
阅读量:6163 次
发布时间:2019-06-21

本文共 1116 字,大约阅读时间需要 3 分钟。

 

183. Customers Who Never Order

Question
Total Accepted: 14489 Total Submissions: 43113 Difficulty: Easy

 

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.

Table: Customers.

+----+-------+| Id | Name  |+----+-------+| 1  | Joe   || 2  | Henry || 3  | Sam   || 4  | Max   |+----+-------+

Table: Orders.

+----+------------+| Id | CustomerId |+----+------------+| 1  | 3          || 2  | 1          |+----+------------+

Using the above tables as example, return the following:

+-----------+| Customers |+-----------+| Henry     || Max       |+-----------+

 

 to see which companies asked this question

 

http://my.oschina.net/liusicong/blog/375039?p={

{currentPage+1}}

 

 

1 # Write your MySQL query statement below2 select Name from Customers c3     where c.Id not in4         (select CustomerId from Orders o)

 

1 # Write your MySQL query statement below2 select Name from 3     Customers c left join Orders o4         on c.Id = o.CustomerId5             where o.Id is NULL 6

 

 

转载于:https://www.cnblogs.com/njczy2010/p/5213471.html

你可能感兴趣的文章
[LeetCode] Happy Number
查看>>
highcharts插件使用总结和开发中遇到的问题及解决办法
查看>>
Ratingbar UseGuide
查看>>
maven之打包插件(maven-assembly-plugin,maven-shade-plugin与maven-assembly-plugin)
查看>>
delphi 开发者 linux 实务(转)
查看>>
app开发团队人员构成怎么分配?国内著名的app开发团队有哪些
查看>>
微信公众平台小程序(应用号)开始内测了
查看>>
实现容器的底层技术 - 每天5分钟玩转 Docker 容器技术(30)
查看>>
PHP基础知识之————PDO预处理语句
查看>>
支付宝微信支付回调地址访问不成功
查看>>
Redis启动报错
查看>>
详解translate
查看>>
【案例】复制静止问题一则
查看>>
抽象类
查看>>
CSS 自动居中一列布局
查看>>
关于MYSQL中FLOAT和DOUBLE类型的存储
查看>>
Oracle后台进程及其作用简介
查看>>
libvirt(virsh命令介绍)
查看>>
HDOJ/HDU 2555 人人都能参加第30届校田径运动会了(判断加排序~)
查看>>
service XXX does not support chkconfig
查看>>