|
| 1 | +<h2><a href="https://leetcode.com/problems/patients-with-a-condition">Patients With a Condition</a></h2> <img src='https://img.shields.io/badge/Difficulty-Easy-brightgreen' alt='Difficulty: Easy' /><hr><p>Table: <code>Patients</code></p> |
| 2 | + |
| 3 | +<pre> |
| 4 | ++--------------+---------+ |
| 5 | +| Column Name | Type | |
| 6 | ++--------------+---------+ |
| 7 | +| patient_id | int | |
| 8 | +| patient_name | varchar | |
| 9 | +| conditions | varchar | |
| 10 | ++--------------+---------+ |
| 11 | +patient_id is the primary key (column with unique values) for this table. |
| 12 | +'conditions' contains 0 or more code separated by spaces. |
| 13 | +This table contains information of the patients in the hospital. |
| 14 | +</pre> |
| 15 | + |
| 16 | +<p> </p> |
| 17 | + |
| 18 | +<p>Write a solution to find the patient_id, patient_name, and conditions of the patients who have Type I Diabetes. Type I Diabetes always starts with <code>DIAB1</code> prefix.</p> |
| 19 | + |
| 20 | +<p>Return the result table in <strong>any order</strong>.</p> |
| 21 | + |
| 22 | +<p>The result format is in the following example.</p> |
| 23 | + |
| 24 | +<p> </p> |
| 25 | +<p><strong class="example">Example 1:</strong></p> |
| 26 | + |
| 27 | +<pre> |
| 28 | +<strong>Input:</strong> |
| 29 | +Patients table: |
| 30 | ++------------+--------------+--------------+ |
| 31 | +| patient_id | patient_name | conditions | |
| 32 | ++------------+--------------+--------------+ |
| 33 | +| 1 | Daniel | YFEV COUGH | |
| 34 | +| 2 | Alice | | |
| 35 | +| 3 | Bob | DIAB100 MYOP | |
| 36 | +| 4 | George | ACNE DIAB100 | |
| 37 | +| 5 | Alain | DIAB201 | |
| 38 | ++------------+--------------+--------------+ |
| 39 | +<strong>Output:</strong> |
| 40 | ++------------+--------------+--------------+ |
| 41 | +| patient_id | patient_name | conditions | |
| 42 | ++------------+--------------+--------------+ |
| 43 | +| 3 | Bob | DIAB100 MYOP | |
| 44 | +| 4 | George | ACNE DIAB100 | |
| 45 | ++------------+--------------+--------------+ |
| 46 | +<strong>Explanation:</strong> Bob and George both have a condition that starts with DIAB1. |
| 47 | +</pre> |
0 commit comments