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 第 206 场周赛(7