[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 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 |
+-----------+
Code
SELECT Name AS Customers FROM Customers AS c WHERE c.Id NOT IN (SELECT CustomerId FROM Orders)
[LeetCode] 183. Customers Who Never Order_Easy tag: SQL的更多相关文章
- LeetCode 183. Customers Who Never Order (从不订购的客户)
题目标签: 题目给了我们 Customers 和 Orders 两个表格,让我们找到 从没订购过的客户. 首先从Orders 得到 订购过的CustomerId,然后再去Customers 里找 没有 ...
- leetcode 183. Customers Who Never Order
select Name as Customers from Customers where Id not in (select CustomerId from Orders);
- 【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] 619. Biggest Single Number_Easy tag: SQL
Table number contains many numbers in column num including duplicated ones.Can you write a SQL query ...
- [LeetCode] 584. Find Customer Referee_Easy tag: SQL
Given a table customer holding customers information and the referee. +------+------+-----------+ | ...
- [LeetCode] 620. Not Boring Movies_Easy tag: SQL
X city opened a new cinema, many people would like to go to this cinema. The cinema also gives out a ...
- [LeetCode] 181. Employees Earning More Than Their Managers_Easy tag: SQL
The Employee table holds all employees including their managers. Every employee has an Id, and there ...
- [LeetCode] 176. Second Highest Salary_Easy tag: SQL
Write a SQL query to get the second highest salary from the Employee table. +----+--------+ | Id | S ...
- [LeetCode] 182. Duplicate Emails_Easy tag: SQL
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...
随机推荐
- Python六大开源框架对比:Web2py略胜一筹(转)
Python是一门动态.面向对象语言.其最初就是作为一门面向对象语言设计的,并且在后期又加入了一些更高级的特性.除了语言本身的设计目的之外,Python标准库也是值得大家称赞的,Python甚至还自带 ...
- springboot---->springboot中的类型转换(一)
这里面我们简单的学习一下springboot中关于类型转换器的使用.人世间的事情莫过于此,用一个瞬间来喜欢一样东西,然后用多年的时间来慢慢拷问自己为什么会喜欢这样东西. springboot中的类型转 ...
- Qt编写数据库通用翻页demo(开源)
在Qt与数据库结合编程的过程中,记录一多,基本上都需要用到翻页查看记录,翻页有个好处就是可以减轻显示数据的表格的压力,不需要一次性将数据库表的记录全部显示,也基本上没有谁在一页上需要一次性显示所有记录 ...
- 五、K3 WISE 开发插件《K3 Wise 群发短信配置开发(一)之短信平台配置》
开发环境:K/3 Wise 13.0 目录 一.创建短信数据库 二.配置短信接口 三.设置帐套关键字 四.查询短信余额 一.创建短信数据库 打开帐套管理: 账号默认为Admin,密码不填: 菜单“系统 ...
- 题目1091:棋盘游戏(DFS)
题目链接:http://ac.jobdu.com/problem.php?pid=1091 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: ...
- 初学lua --lua嵌入c++的一个问题(初始化lua出错,版本问题)
初学lua.从http://lua-users.org/wiki/CallingLuaFromCpp上下载了一个lua嵌入C++的代码.编译并运行.发现有错误: PANIC: unprotected ...
- [转][darkbaby]任天堂传——失落的泰坦王朝(中)
TV游戏产业历史上曾有过太多表里不一的外交辞令,然而当年SQUARE和任天堂分道扬镳的真正原因确实如坂口博信在1996年2月29日的PS版 <FFVII>发表会上宣称的那样:“虽然之前有过 ...
- CentOS6.5 下将 Python2.6.6 升级到Python3.5
一. 从Python官网到获取Python3的包, 切换到目录/usr/local/src #wget https://www.python.org/ftp/python/3.5.1/Python-3 ...
- JPA的锁机制
JPA 各种实体锁模式的区别 字数2084 阅读304 评论0 喜欢4 为了能够同步访问实体,JPA提供了2种锁机制.这两种机制都可以避免两个事务中的其中一个,在不知情的情况下覆盖另一个事务的数据. ...
- 2.3AutoEncoder
AutoEncoder是包含一个压缩和解压缩的过程,属于一种无监督学习的降维技术. 神经网络接受大量信息,有时候接受的数据达到上千万,可以通过压缩 提取原图片最具有代表性的信息,压缩输入的信息量,在将 ...