DAY01-选择

595. 大的国家 - 力扣(LeetCode)

select name,population,area 
from World 
where area >=3000000 or population >=25000000;

1757. 可回收且低脂的产品 - 力扣(LeetCode)

select product_id 
from Products 
where (low_fats = 'Y') and (recyclable = 'Y');

584. 寻找用户推荐人 - 力扣(LeetCode)

select name
from customer 
where referee_id !=2 OR referee_id is NULL;

183. 从不订购的客户 - 力扣(LeetCode)--左外连接

SELECT c.Name as Customers 
from Customers c left join Orders o
on c.Id = o.CustomerId
where o.Id is NULL;

联表查询:

内链接

select 字段 from 表1 inner join 表2 on 连接条件

外连接

(21条消息) MySql之联表查询_爱喝水的小鼠的博客-CSDN博客

猜你喜欢

转载自blog.csdn.net/weixin_56194193/article/details/129672880