【Leetcode】Customers Who Never Order
题目链接:https://leetcode.com/problems/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 |
+———–+
思路:
left或right join,选择customerid为空的就是没有进行过交易的。
算法:
select Name from Customers c left outer join Orders o on o.CustomerId=c.Id where o.CustomerId is null
【Leetcode】Customers Who Never Order相关推荐
- 【leetcode】86. Partition List
题目如下: Given a linked list and a value x, partition it such that all nodes less than x come before no ...
- 【leetcode】109. Convert Sorted List to Binary Search Tree
题目如下: Given a singly linked list where elements are sorted in ascending order, convert it to a heigh ...
- 【LeetCode】863. All Nodes Distance K in Binary Tree 解题报告(Python)
[LeetCode]863. All Nodes Distance K in Binary Tree 解题报告(Python) 作者: 负雪明烛 id: fuxuemingzhu 个人博客: http ...
- 【Leetcode】100. 相同的树
题目 给定两个二叉树,编写一个函数来检验它们是否相同. 如果两个树在结构上相同,并且节点具有相同的值,则认为它们是相同的. 示例 1: 输入: 1 1/ \ / \2 3 2 3[1,2,3], [1 ...
- 【leetcode】85. Maximal Rectangle 0/1矩阵的最大全1子矩阵
1. 题目 Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing only 1 ...
- 【leetcode】486. Predict the Winner
题目如下: Given an array of scores that are non-negative integers. Player 1 picks one of the numbers fro ...
- 【leetcode】132. Palindrome Partitioning II
题目如下: 解题思路:本题是[leetcode]131. Palindrome Partitioning的升级版,要求的是求出最小cuts,如果用[leetcode]131. Palindrome P ...
- 【Leetcode】103. 二叉树的锯齿形层次遍历
题目 给定一个二叉树,返回其节点值的锯齿形层次遍历.(即先从左往右,再从右往左进行下一层遍历,以此类推,层与层之间交替进行). 例如: 给定二叉树 [3,9,20,null,null,15,7], 3 ...
- 【Leetcode】79.单词搜索
题目 给定一个二维网格和一个单词,找出该单词是否存在于网格中. 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中"相邻"单元格是那些水平相邻或垂直相邻的单元格.同一个单元格 ...
最新文章
- 「赠书」贾扬清推荐,国内首本数据竞赛图书
- docker基础介绍
- linux 后台运行_Linux系统后台运行应用三板斧
- 【ArcGIS|空间分析】数据交互(Google Earth与ArcGIS,ENVI与ArcGIS)
- Power Apps相关介绍
- 计算机类sci中接受综述么,sci综述类期刊有哪些
- 加权平均值不等式的证明
- 南阳oj 题目10 skiing
- c# 枚举的定义,枚举的用法,获取枚举值
- PuTTY 远程连接 Linux 服务器
- 数据库中查询经纬度距离远近
- 小说阅读网html+css+JavaScript
- gcc参数-Wl,–gc-sections,不链接未用函数,减小可执行文件大小
- 通过C#生成支付宝收款码 三(支付宝官方SDK配合沙箱调试扫条码支付)
- 你想要的继承知识点都在这里
- C++STL的发展历程
- ruby 实现 bing 的 geocode
- X-former:不止一面,你想要的Transformer这里都有
- 宝塔面板上行下行,总发送总接收是什么意思?
- 51单片机+L298驱动步进电机+L297测速+LCD1602显示+按键调试+Proteus仿真
热门文章
- 空气质量(air quality) 简称:AQI 计算AQI等笔记
- 4.7 合成复用原则
- 论文阅读:Regularizing Deep Networks with Semantic Data Augmentation
- 【无标题】我们的三周年————致我的小宝贝
- 应用程序无法运行,不是有效的Win32位程序解决(新手向)
- Convolution Arithmetic
- 浅谈ES6后的TDZ时间死区
- 北京博物馆十大镇馆之宝
- 微信抢抢票服务器,已有多人被坑!抢票“加速包”慎用!
- 阿里云虚拟机Windows系统控制台解压缩文件提示操作异常、解压缩失败的解决方案