Customers Who Never Order

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 |
±----------+

Solution

# Write your MySQL query statement below
SELECT Name AS CustomersFROM Customers c LEFT JOIN Orders o ON c.Id = o.CustomerIdWHERE o.Id IS NULL

Customers Who Never Order相关推荐

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

    ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★ ➤微信公众号:山青咏芝(shanqingyongzhi) ➤博客园地址:山青咏芝(https://www.cnblog ...

  2. LeetCode:183.Customers Who Never Order

    题目: Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQ ...

  3. 【Leetcode】Customers Who Never Order

    题目链接:https://leetcode.com/problems/customers-who-never-order/ 题目: Suppose that a website contains tw ...

  4. LeetCode: 183. Customers Who Never Order

    LeetCode: 183. Customers Who Never Order 题目描述 Suppose that a website contains two tables, the Custom ...

  5. 183. Customers Who Never Order

    原题链接:https://leetcode.com/problems/customers-who-never-order/description/ 做完这道题目我才发现,我跟不就不懂 in, exis ...

  6. 183. Customers Who Never Order没有下过订单的顾客MySQL

    假设一个网站包含两个表,Customers表和Orders表.编写SQL查询以查找所有没订购任何商品的客户. customers orders Output 用到left  outer join: s ...

  7. LeetCode-183. 从不订购的客户( Customers Who Never Order)。

    某网站包含两个表,Customers 表和 Orders 表.编写一个 SQL 查询,找出所有从不订购任何东西的客户. Customers 表: +----+-------+ | Id | Name ...

  8. leetcode 183. Customers Who Never Order

    题意:查找没有点过单的客人 题目链接:https://leetcode.com/problems/customers-who-never-order/ select Name from Custome ...

  9. Leetcode#183. Customers Who Never Order

    题目描述:查找没有预定(orders)的顾客(customers) 普通方法: select Name as Customers from Customers c where c.Id not in ...

最新文章

  1. directx 双缓冲 运动 闪烁_24期0利率 | BMW超值福袋开启“双11”购车狂欢节!!
  2. Algorithm:论一个产品经理的十八般武艺
  3. springboot去掉git版本控制_关于 Git 提交这些规范,你都遵守了吗?
  4. python中numpy与matlab的对应关系
  5. noclassdeffounderror java,从终端运行Java文件时出现java.lang.NoClassDefFoundError
  6. 基础笔试编程题(jz)
  7. eclipse启动失败:An internal error occurred during: reload maven project
  8. 【第一组】典型场景:学生选课时查看选课推荐,教师推荐
  9. 属性值动态调整_这可能是你见过最牛的CAD粗糙度动态块了!
  10. Hive常见的属性配置
  11. 英文简历中的自我评价
  12. 删除进程id_Mysql新增删除数据失败,提示锁表
  13. 基于 Android Architecture Components 的 MVVM 浅析
  14. 整数实例hdu2041(超级楼梯)
  15. Java MyEclipse 实现微信跳一跳小程序
  16. WebRTC基本概念
  17. url 编码(percentcode 百分号编码)
  18. 高通骁龙各代处理器解析
  19. linux删除用户命令userdel
  20. 当前佛教界的乱相之一就是以凡滥圣、惑乱人心

热门文章

  1. 为你的网站添加 htpps
  2. Android实现图片轮播
  3. 海德汉 LSV2 协议采集 2
  4. 病毒防治:清除***从它的寄生地开始
  5. 国培计算机音乐教学设计作业,2017国培计划教学设计
  6. Moment.js 2.22.2 源代码
  7. ai中如何插入签名_怎么将CAD中插入图片的多余部分抠掉?如何设置透明效果?...
  8. 移动应用/APP的测试流程及方法
  9. Socket_Tcp加密文件传输系统
  10. python批量打印pdf_通过Dynamo批量打印PDF图纸