LeetCode MySQL 1527. Patients With a Condition(like)
生活随笔
收集整理的这篇文章主要介绍了
LeetCode MySQL 1527. Patients With a Condition(like)
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
文章目录
- 1. 题目
- 2. 解题
1. 题目
Table: Patients
+--------------+---------+ | Column Name | Type | +--------------+---------+ | patient_id | int | | patient_name | varchar | | conditions | varchar | +--------------+---------+ patient_id is the primary key for this table. 'conditions' contains 0 or more code separated by spaces. This table contains information of the patients in the hospital.Write an SQL query to report the patient_id, patient_name all conditions of patients who have Type I Diabetes. Type I Diabetes always starts with DIAB1 prefix
Return the result table in any order.
The query result format is in the following example.
Patients +------------+--------------+--------------+ | patient_id | patient_name | conditions | +------------+--------------+--------------+ | 1 | Daniel | YFEV COUGH | | 2 | Alice | | | 3 | Bob | DIAB100 MYOP | | 4 | George | ACNE DIAB100 | | 5 | Alain | DIAB201 | +------------+--------------+--------------+Result table: +------------+--------------+--------------+ | patient_id | patient_name | conditions | +------------+--------------+--------------+ | 3 | Bob | DIAB100 MYOP | | 4 | George | ACNE DIAB100 | +------------+--------------+--------------+ Bob and George both have a condition that starts with DIAB1.来源:力扣(LeetCode)
链接:https://leetcode-cn.com/problems/patients-with-a-condition
著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
2. 解题
# Write your MySQL query statement below select * from Patients where conditions like "%DIAB1%"217 ms
我的CSDN博客地址 https://michael.blog.csdn.net/
长按或扫码关注我的公众号(Michael阿明),一起加油、一起学习进步!
总结
以上是生活随笔为你收集整理的LeetCode MySQL 1527. Patients With a Condition(like)的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: LeetCode 294. 翻转游戏 I
- 下一篇: LeetCode MySQL 1412.