当前位置:网站首页>LeetCode-1757. 可回收且低脂的产品_SQL
LeetCode-1757. 可回收且低脂的产品_SQL
2022-06-23 03:55:00 【_trickle】
- SQL架构
表:Products
±------------±--------+
| Column Name | Type |
±------------±--------+
| product_id | int |
| low_fats | enum |
| recyclable | enum |
±------------±--------+
product_id 是这个表的主键。
low_fats 是枚举类型,取值为以下两种 (‘Y’, ‘N’),其中 ‘Y’ 表示该产品是低脂产品,‘N’ 表示不是低脂产品。
recyclable 是枚举类型,取值为以下两种 (‘Y’, ‘N’),其中 ‘Y’ 表示该产品可回收,而 ‘N’ 表示不可回收。
写出 SQL 语句,查找既是低脂又是可回收的产品编号。
返回结果 无顺序要求 。
查询结果格式如下例所示:
Products 表:
±------------±---------±-----------+
| product_id | low_fats | recyclable |
±------------±---------±-----------+
| 0 | Y | N |
| 1 | Y | Y |
| 2 | N | Y |
| 3 | Y | Y |
| 4 | N | N |
±------------±---------±-----------+
Result 表:
±------------+
| product_id |
±------------+
| 1 |
| 3 |
±------------+
只有产品 id 为 1 和 3 的产品,既是低脂又是可回收的产品。
程序代码
# Write your MySQL query statement below
select product_id
from Products
where low_fats = 'Y' and recyclable = 'Y'
边栏推荐
- Drag and drop frame
- insert into... where not exists插入避免重复的使用
- A bug in rtklib2.4.3 B34 single point positioning
- What is the average annual salary of an outsourced tester who has worked for 5-8 years?
- JSP entry notes
- Arduino火焰传感器(含代码)
- Post processing of multisensor data fusion using Px4 ECL
- [laravel series 7.8] broadcasting system
- Hcip fifth operation
- Brief ideas and simple cases of JVM tuning - why do you need JVM tuning?
猜你喜欢

【微服务|Nacos】Nacos版本相关问题一览

Calculate Euclidean distance and cosine similarity

PRCS-1016 : Failed to resolve Single Client Access Name

UnityShader入门精要——Unity中的渲染优化技术(四)

TIOBE 编程语言排行榜是编程语言流行趋势的一个指标

渗透测试基础 | 附带测试点、测试场景

Event日志关键字:EventLogTags.logtags

insert into... where not exists插入避免重复的使用

Jetpack Compose 从开门到入门之 MenuBar桌面菜单(Desktop Menu)

(IntelliJ)插件一 Background Image Plus
随机推荐
mongodb分片原理
【Mac】安全性与隐私中没有任何来源选项
STP总结
Swiftui 2.0 course notes Chapter 5
Fund performance evaluation
飞桨框架v2.3发布高可复用算子库PHI!重构开发范式,降本增效
Unity中,如何在【编辑器】和【运行时】状态下读写一个ScriptableObject对象
Course design C for freshmen -- clothing management system
BGP experiment
Learn to draw Er graph in an article
Implementation of the rotation chart
I have been engaged in software testing for 5 years and have changed jobs for 3 times. I have understood the field of software testing
MMDeploy快速安装及使用说明
Baidu PaddlePaddle's "universal gravitation" first stop in 2022 landed in Suzhou, comprehensively launching the SME empowerment plan
Image noise reduction denoise AI
Penetration test basis | attached test points and test scenarios
teqc进行GNSS数据质量分析时生成的s文件介绍
Mongodb sharding principle
Architecture à trois niveaux MVC
985 test engineer is hanged. Who is more important in terms of education and experience?