1757. 可回收且低脂的产品
题目链接:https://leetcode.cn/problems/recyclable-and-low-fat-products/description/?envType=study-plan-v2&envId=sql-free-50
状态:已完成
考点:无
select product_id
from Products
where low_fats = 'Y' and recyclable = 'Y'
584. 寻找用户推荐人
题目链接:https://leetcode.cn/problems/find-customer-referee/description/?envType=study-plan-v2&envId=sql-free-50
状态:已完成
考点:where子句的等值判断会自动忽略null值,因此需要增加判空逻辑
select name
from Customer
where referee_id != 2 or referee_id is null
595. 大的国家
题目链接:https://leetcode.cn/problems/big-countries/description/?envType=study-plan-v2&envId=sql-free-50
状态:已完成
考点:无
select name, population, area
from World
where area >= 3000000 or population >= 25000000
1683. 无效的推文
题目链接:https://leetcode.cn/problems/invalid-tweets/description/?envType=study-plan-v2&envId=sql-free-50
状态:已完成
考点:length()函数求解字符串的长度
select tweet_id
from Tweets
where length(content) > 15
1148. 文章浏览 I
题目链接:https://leetcode.cn/problems/article-views-i/description/?envType=study-plan-v2&envId=sql-free-50
状态:已完成
考点:修改列名(as),去重(distinct),排序(order by,默认升序)
select distinct author_id as id
from Views
where author_id = viewer_id
order by author_id