LeetCode 183. Customers Who Never Order (从不订购的客户)
题目标签:
题目给了我们 Customers 和 Orders 两个表格,让我们找到 从没订购过的客户。
首先从Orders 得到 订购过的CustomerId,然后再去Customers 里找 没有出现过的 Id,返回名字。
Java Solution:
Runtime: 264 ms, faster than 53 %
Memory Usage: N/A
完成日期:06/01/2019
关键点:NOT IN
# Write your MySQL query statement below
SELECT Customers.Name AS Customers
FROM Customers
WHERE Customers.Id NOT IN (SELECT CustomerId FROM Orders);
参考资料:n/a
LeetCode 题目列表 - LeetCode Questions List
题目来源:https://leetcode.com/
LeetCode 183. Customers Who Never Order (从不订购的客户)的更多相关文章
- leetcode 183. Customers Who Never Order
select Name as Customers from Customers where Id not in (select CustomerId from Orders);
- [SQL]LeetCode183. 从不订购的客户 | Customers Who Never Order
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...
- LeetCode:183.从不订购的客户
题目链接:https://leetcode-cn.com/problems/customers-who-never-order/ 题目 某网站包含两个表 Customers 表和 Orders 表.编 ...
- 183. Customers Who Never Order
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...
- 力扣(LeetCode)从不订购的客户-数据库题 个人题解
SQL架构 某网站包含两个表,Customers 表和 Orders 表.编写一个 SQL 查询,找出所有从不订购任何东西的客户. Customers 表: +----+-------+ | Id | ...
- sql 183. 从不订购的客户
SQL架构 某网站包含两个表,Customers 表和 Orders 表.编写一个 SQL 查询,找出所有从不订购任何东西的客户. Customers 表: +----+-------+ | Id | ...
- [LeetCode] 183. Customers Who Never Order_Easy tag: SQL
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...
- 【SQL】183. Customers Who Never Order
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...
- [LeetCode] Customers Who Never Order 从未下单订购的顾客
Suppose that a website contains two tables, the Customers table and the Orders table. Write a SQL qu ...
随机推荐
- table标签详解
1.table标签中没有 tbody标签,浏览器会自动加上去的 2.一般表格的布局可以不使用 thead.tfoot 以及 tbody 元素.这样浏览器解析时会自动给一个 tbody标签的. 完整的 ...
- python之-sqlite3
在这些 URL 中,hostname 表示 MySQL 服务所在的主机,可以是本地主机(localhost),也可以是远程服务器.数据库服务器上可以托管多个数据库,因此 database 表示要使用的 ...
- JZOI1169A 平均数Ave
#include <cstdio> #include <cmath> #define lztin() read() #define ztyout( a ) printf( &q ...
- delphi基础篇之数据类型之三:3.结构类型(Struct)
3.结构类型(Struct) 结构类型在内存中存储一组相关的数据项,而不是像简单数据类型那样单一的数值.结构数据类型包括:集合类型.数组类型.记录类型.文件类型.类类型.类引用类型和接口类型等.
- PHP简单读取XML
DOM document object model,文档对象模型,就是树形结构 节点的分类 元素节点 属性节点 值节点 注释节点 根节点(document才是根节点) 生成XML文档 xml的根节点为 ...
- FreeBSD_11-系统管理——{Part_9-SVN}
一.使用 svn / svnlite 代替 freebsd-update 及 portsnap 等常规工具更新系统及 ports 源码 二.安装可信 ca 机构列表 cd /usr/ports/sec ...
- mybatis执行test07测试类却显示test05测试类调用的sql语句出错
1.测试类 @Test public void test07() { IStudentDao studentDao = new IStudentDaoImpl(); Student student = ...
- 通过MyEclipse操作数据库,执行sql语句使我们不用切换多个工具,直接工作,方便快捷
通过MyEclipse操作数据库,执行sql语句使我们不用切换多个工具,直接工作,方便快捷.效果如下: 步骤1:通过MyEclipse中的window->show View->ot ...
- 高级UI晋升之布局ViewGroup(四)
更多Android高级架构进阶视频学习请点击:https://space.bilibili.com/474380680本篇文章将从LinearLayout.RelativeLayout.FrameLa ...
- 5-vim-工作模式-02-工作模式切换演练
1.末行模式 命令 英文 功能 : 进入末行模式 w write 保存 q quit 退出,如果没有保存,不允许退出 q! quit 强行退出,不保存退出 wq write&quit 保存 ...