MySQL是一种常用的关系型数据库管理系统,广泛应用于各种Web应用程序中。在编程中,使用MySQL进行数据操作是非常常见的操作。在MySQL中,查询是最常用的操作之一,可以查询整个表或者根据特定的条件查询数据。
文章目录
- 一、查询
- (一)[1757. 可回收且低脂的产品](https://leetcode.cn/problems/recyclable-and-low-fat-products/description/?envType=study-plan-v2&envId=sql-free-50)
- (二)[84. 寻找用户推荐人](https://leetcode.cn/problems/find-customer-referee/description/?envType=study-plan-v2&envId=sql-free-50)
- (三)[595. 大的国家](hhttps://leetcode.cn/problems/big-countries/?envType=study-plan-v2&envId=sql-free-50)
- (四)[1148. 文章浏览 I](https://leetcode.cn/problems/article-views-i/description/?envType=study-plan-v2&envId=sql-free-50)
- (五)[1683. 无效的推文](https://leetcode.cn/problems/article-views-i/description/?envType=study-plan-v2&envId=sql-free-50)
一、查询
(一)1757. 可回收且低脂的产品
select product_id from Products where low_fats = 'Y' and recyclable = 'Y';
(二)84. 寻找用户推荐人
select name from customer where referee_id != 2 or referee_id is null;
(三)595. 大的国家
# Write your MySQL query statement below
select name,population,area from World where population >= 25000000 or area >= 3000000;
(四)1148. 文章浏览 I
# Write your MySQL query statement below
select distinct author_id id from Views where author_id = viewer_id order by id;
(五)1683. 无效的推文
# Write your MySQL query statement below
select tweet_id from Tweets where char_length(content) > 15;