当前位置:网站首页>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%';
边栏推荐
- [ROS] (10) ROS Communication - Service Communication
- 线性表的查找
- iNFTnews | 对体育行业和球迷来说,NFT可以带来什么?
- 2022了你还不会『低代码』?数据科学也能玩转Low-Code啦!
- 2022-08-04: Input: deduplicated array arr, the numbers in it only contain 0~9.limit, a number.Return: The maximum number that can be spelled out with arr if the requirement is smaller than limit.from
- 基于左序遍历的数据存储实践
- 使用SuperMap iDesktopX数据迁移工具迁移地图文档和符号
- 【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?
- 多线程(2)
- [机缘参悟-60]:《兵者,诡道也》-2-孙子兵法解读
猜你喜欢

Using OpenVINO to implement the flying paddle version of the PGNet inference program

Simple implementation of YOLOv7 pre-training model deployment based on OpenVINO toolkit

Pisanix v0.2.0 released | Added support for dynamic read-write separation

nodeJs--封装路由

HOG feature study notes

01 【前言 基础使用 核心概念】

leetcode 15

C语言日记 9 if的3种语句

Tree search (bintree)

学习笔记-----左偏树
随机推荐
Go 微服务开发框架 DMicro 的设计思路
leetcode-对称二叉树
线上MySQL的自增id用尽怎么办?
Greenplum数据库故障分析——版本升级后gpstart -a为何返回失败
C语言实现简单猜数字游戏
hypervisor相关的知识点
【C语言】详解栈和队列(定义、销毁、数据的操作)
Introduction to SDC
nodeJs--encapsulate routing
特殊矩阵的压缩存储
[ROS](10)ROS通信 —— 服务(Service)通信
lua学习
继承关系下构造方法的访问特点
程序员失眠时的数羊列表 | 每日趣闻
Quickly learn chess from zero to one
shell statement to modify txt file or sh file
继承关系下构造方法的访问特点
SDC简介
使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据
后期学习计划