当前位置: 首页 > news >正文

Mysql基础练习题 1527.患某种疾病的患者 (力扣)

查询患有 I 类糖尿病的患者 ID (patient_id)、患者姓名(patient_name)以及其患有的所有疾病代码(conditions)。I 类糖尿病的代码总是包含前缀 DIAB1 。

题目链接:

https://leetcode.cn/problems/patients-with-a-condition/

建表插入语句:

Create table If Not Exists Patients (patient_id int, patient_name varchar(30), conditions varchar(100))
Truncate table Patients
insert into Patients (patient_id, patient_name, conditions) values ('1', 'Daniel', 'YFEV COUGH')
insert into Patients (patient_id, patient_name, conditions) values ('2', 'Alice', '')
insert into Patients (patient_id, patient_name, conditions) values ('3', 'Bob', 'DIAB100 MYOP')
insert into Patients (patient_id, patient_name, conditions) values ('4', 'George', 'ACNE DIAB100')
insert into Patients (patient_id, patient_name, conditions) values ('5', 'Alain', 'DIAB201')

画图分析:

代码实现:

select patient_id,patient_name,conditions 
from patients 
where conditions like '% DIAB1%' or conditions like 'DIAB1%';

http://www.lryc.cn/news/434709.html

相关文章:

  • Mysql链接异常 | [08001] Public Key Retrieval is not allowed
  • vue3项目中如何动态循环设置ref并获取使用
  • stm32之SPI通信协议
  • Unity 摄像机(Camera)详解
  • 数学基础 -- 线性代数之LU分解
  • 高职人工智能训练师边缘计算实训室解决方案
  • 【Java】SpringCloud中使用set方法报错空指针
  • 芯片杂谈 -- 常聊的内核包含哪些模块
  • 运维问题0002:SAP多模块问题-SAP系统程序在执行时,跳出“加急快件”窗口,提示:快件文档“更新已终止”从作者***收到
  • 深度解析RAG:你必须要了解的RAG优化方法
  • 深度学习驱动下的字符识别:挑战与创新
  • 使用 JAXB 将内嵌的JAVA对象转换为 xml文件
  • 若依项目后台启动报错: [网关异常处理]、503
  • 【C++ Qt day10】
  • GO HTTP库使用
  • 数据结构 - 顺序表
  • 企业如何组建安全稳定的跨国通信网络?
  • OCR在线识别网站现已上线!
  • 排名再升2位 中国平安位列BrandZ最具价值中国品牌第9位
  • k8s集群部署:环境准备
  • <C++> set、map模拟实现
  • 软考学习 数据结构 查找
  • h264 视频流中添加目标检测的位置、类型信息到SEI帧
  • 大模型api谁家更便宜
  • 代码随想录算法训练营第二十三天| 455. 分发饼干、376. 摆动序列、53. 最大子序和
  • react js 路由 Router
  • AplPost使用
  • 【Qt】Qt与Html网页进行数据交互
  • 教师节特辑:AI绘制的卡通人物,致敬最可爱的人‍
  • SprinBoot+Vue智慧农业专家远程指导系统的设计与实现