You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
patient_id is the primary key (column with unique values) for this table.
18
+
'conditions' contains 0or more code separated by spaces.
19
+
This table contains information of the patients in the hospital.
20
+
21
+
22
+
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 DIAB1 prefix.
23
+
24
+
Return the result table in any order.
25
+
26
+
The result format is in the following example.
27
+
28
+
29
+
30
+
Example 1:
31
+
32
+
Input:
33
+
Patients table:
34
+
+------------+--------------+--------------+
35
+
| patient_id | patient_name | conditions |
36
+
+------------+--------------+--------------+
37
+
| 1 | Daniel | YFEV COUGH |
38
+
| 2 | Alice | |
39
+
| 3 | Bob | DIAB100 MYOP |
40
+
| 4 | George | ACNE DIAB100 |
41
+
| 5 | Alain | DIAB201 |
42
+
+------------+--------------+--------------+
43
+
Output:
44
+
+------------+--------------+--------------+
45
+
| patient_id | patient_name | conditions |
46
+
+------------+--------------+--------------+
47
+
| 3 | Bob | DIAB100 MYOP |
48
+
| 4 | George | ACNE DIAB100 |
49
+
+------------+--------------+--------------+
50
+
Explanation: Bob and George both have a condition that starts with DIAB1.
51
+
52
+
53
+
54
+
# Write your MySQL query statement below
55
+
SELECT patient_id, patient_name, conditions
56
+
FROM Patients
57
+
WHERE conditions LIKE'DIAB1%'OR conditions LIKE'% DIAB1%'
0 commit comments