当前位置:网站首页>1527. 患某种疾病的患者
1527. 患某种疾病的患者
2022-08-05 02:32:00 【只是六号z】
前言
患者信息表: Patients
+--------------+---------+
| Column Name | Type |
+--------------+---------+
| patient_id | int |
| patient_name | varchar |
| conditions | varchar |
+--------------+---------+
patient_id (患者 ID)是该表的主键。
'conditions' (疾病)包含 0 个或以上的疾病代码,以空格分隔。
这个表包含医院中患者的信息。
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/patients-with-a-condition
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
写一条 SQL 语句,查询患有 I 类糖尿病的患者 ID (patient_id)、患者姓名(patient_name)以及其患有的所有疾病代码(conditions)。I 类糖尿病的代码总是包含前缀 DIAB1 。
按 任意顺序 返回结果表。
查询结果格式如下示例所示。
示例1:
输入:
Patients表:
+------------+--------------+--------------+
| patient_id | patient_name | conditions |
+------------+--------------+--------------+
| 1 | Daniel | YFEV COUGH |
| 2 | Alice | |
| 3 | Bob | DIAB100 MYOP |
| 4 | George | ACNE DIAB100 |
| 5 | Alain | DIAB201 |
+------------+--------------+--------------+
输出:
+------------+--------------+--------------+
| patient_id | patient_name | conditions |
+------------+--------------+--------------+
| 3 | Bob | DIAB100 MYOP |
| 4 | George | ACNE DIAB100 |
+------------+--------------+--------------+
解释:Bob 和 George 都患有代码以 DIAB1 开头的疾病。
来源:力扣(LeetCode)
链接:https://leetcode.cn/problems/patients-with-a-condition
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
like
select
patient_id,patient_name,conditions
from
Patients
where
// 因为conditions字段符合DIAB1的前面会有空格,所以使用 '% xxx%'
conditions like 'DIAB1%' or conditions like '% DIAB1%';
边栏推荐
- The 20th day of the special assault version of the sword offer
- Matlab map with color representation module value size arrow
- mysql树状结构查询问题
- 1484. 按日期分组销售产品
- 02 [Development Server Resource Module]
- Matlab画图3
- QT语言文件制作
- C student management system Insert the student node at the specified location
- 领域驱动设计——MDD
- "Dilili, wait for the lights, wait for the lights", the prompt sound for safe production in the factory
猜你喜欢
随机推荐
2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
回顾51单片机
RAID磁盘阵列
C语言日记 9 if的3种语句
用@Mapper查询oracle的分区情况报错
如何模拟后台API调用场景,很细!
ARM Mailbox
蚁剑高级模块开发
C student management system Insert the student node at the specified location
How to simply implement the quantization and compression of the model based on the OpenVINO POT tool
解决connect: The requested address is not valid in its context
程序员失眠时的数羊列表 | 每日趣闻
HOG feature study notes
Greenplum数据库故障分析——版本升级后gpstart -a为何返回失败
Intel XDC 2022 Wonderful Review: Build an Open Ecosystem and Unleash the Potential of "Infrastructure"
Greenplum数据库故障分析——能对数据库base文件夹进行软连接嘛?
基于OpenVINO工具套件简单实现YOLOv7预训练模型的部署
编译预处理等细节
What should I do if the self-incrementing id of online MySQL is exhausted?
【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?









