当前位置: 首页 > 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.mrgr.cn/news/24008.html

相关文章:

  • NVDLA专题14:Runtime environment-用户模式驱动
  • 【网易低代码】第3课,页面表格删除功能
  • debug对于开发工程师很重要
  • 基于Springboot的鲜花销售网站的设计与实现
  • 解决 git 不是内部或外部命令,也不是可运行的程序
  • Vue双向数据绑定代码解读
  • 秃姐学AI系列之:实战Kaggle比赛:图像分类(CIFAR-10)
  • 技术美术一百问(01)
  • 大学生必看干货!分享5款ai写毕业论文软件
  • Java项目: 基于SpringBoot+mybatis+maven衣依服装销售平台服装商城分前后台(含源码+数据库+毕业论文)
  • 【代码随想录】字符串
  • windows手工杀毒-关闭恶意弹窗
  • Frozen CLIP: A Strong Backbone for Weakly Supervised Semantic Segmentation
  • gpio子系统
  • 【Nacos】健康检查与环境隔离
  • Shell入门
  • 二叉树详解
  • MFC之CString类及其成员函数用法详解
  • 【表达式求值】
  • langgraph tool如何发送自定义事件