今天和大家聊的问题叫做 从不订购的客户 ,我们先来看题面:https://leetcode-cn.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.
题意
某网站包含两个表,Customers 表和 Orders 表。编写一个 SQL 查询,找出所有从不订购任何东西的客户。
解题
此题比较简单,
查询目标:Name(As Customers)查询范围:Customers表和Orders表查询条件:从不订购任何东西。
select Customers.Name as Customers from Customers left join Orders on Customers.Id = Orders.CustomerId where Orders.Id is null
好了,今天的文章就到这里,如果觉得有所收获,请顺手点个在看或者转发吧,你们的支持是我最大的动力 。