LeetCode - Customers Who Never Order

Description:

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

一种比较高效的方法是左连接,左连接之后任然使用被连接的两个表或多个表来定位连接之后的表的数据。

# Write your MySQL query statement below
select Name
from (Customers c left join Orders o on c.Id=o.CustomerId)
where o.Id is null;
时间: 2024-08-04 14:08:55

LeetCode - Customers Who Never Order的相关文章

[LeetCode] 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

[LeetCode][SQL]Customers Who Never Order

https://leetcode.com/problems/customers-who-never-order/ 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: Customer

【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

【leetcode SQL】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

leetcode 183: 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 |

DataBase -- Customers Who Never Order

Question: 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 |

[leetcode]Binary Tree Level Order Traversal @ Python

原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal/ 题意:二叉树的层序遍历的实现. 解题思路:二叉树的层序遍历可以用bfs或者dfs来实现.这里使用的dfs实现,代码比较简洁.实际上,二叉树的先序遍历就是dfs实现.   比如一棵树如下: 1 /  \ 2       3 /    \    /   \ 4     5  6    7    二叉树的先序遍历为{1,2,4,5,3,6,7},可以看到这个遍

[LeetCode]-DataBase-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

[leetcode]Binary Tree Level Order Traversal II @ Python

原题地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal-ii/ 题意: Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example:Given binary