링크
https://leetcode.com/problems/patients-with-a-condition/description/
문제
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.
Return the result table in any order.
The result format is in the following example.
정답
select *
from patients
where conditions like "DIAB1%"
or conditions like "% DIAB1%"
오답
select *
from patients
where conditions like "DIAB1%"
or conditions like "%_DIAB1%"
해설
- like: _가 있는 경우 문자가 있으면 추출
- like: ' '(공백)이 있는 경우 공백을 넣어야 인식
'[업무 지식] > MySQL' 카테고리의 다른 글
[Limit/Offset] Second Highest Salary (0) | 2024.11.18 |
---|---|
[delete] Delete Duplicate Emails (0) | 2024.11.14 |
[upper, lower] Fix Names in a Table (0) | 2024.11.14 |
[row/between] 프레임 정의 (0) | 2024.11.12 |
[WINDOW] Restaurant Growth (0) | 2024.11.11 |