当前位置:网站首页>1527. Patients suffering from a disease
1527. Patients suffering from a disease
2022-08-05 02:32:00 【just six 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字段符合DIAB1there will be a space in front of the,所以使用 '% xxx%'
conditions like 'DIAB1%' or conditions like '% DIAB1%';
边栏推荐
- js中try...catch和finally的用法
- What should I do if the self-incrementing id of online MySQL is exhausted?
- [ROS] (10) ROS Communication - Service Communication
- C language implements a simple number guessing game
- C语言实现简单猜数字游戏
- ".NET IoT from scratch" series
- 解决connect: The requested address is not valid in its context
- Apache DolphinScheduler新一代分布式工作流任务调度平台实战-中
- [Decryption] Can the NFTs created by OpenSea for free appear in my wallet without being chained?
- 关于#sql shell#的问题,如何解决?
猜你喜欢

蚁剑高级模块开发

VSCode Change Default Terminal 如何修改vscode的默认terminal

Tree search (bintree)

使用SuperMap iDesktopX数据迁移工具迁移ArcGIS数据

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

在这个超连接的世界里,你的数据安全吗

Matlab map with color representation module value size arrow

Flink 1.15.1 集群搭建(StandaloneSession)

【解密】OpenSea免费创造的NFT都没上链竟能出现在我的钱包里?

HOG feature study notes
随机推荐
Matlab画图3
Pisanix v0.2.0 发布|新增动态读写分离支持
the mechanism of ideology
在这个超连接的世界里,你的数据安全吗
Note that Weifang generally needs to pay attention to issuing invoices
STM32使用stm32cubemx LL库系列教程
后期学习计划
RAID disk array
回顾51单片机
【OpenCV 图像处理2】:OpenCV 基础知识
【MySQL series】- Does LIKE query start with % will make the index invalid?
01 [Foreword Basic Use Core Concepts]
RAID磁盘阵列
Fragment visibility judgment
数据增强Mixup原理与代码解读
线上MySQL的自增id用尽怎么办?
HOG feature study notes
SDC简介
Pisanix v0.2.0 released | Added support for dynamic read-write separation
How do programmers without objects spend the Chinese Valentine's Day