관리 메뉴

오늘도 배운다

1527. Patients With a Condition / LeetCode, SQL, MySQL 본문

코딩테스트연습(SQL)

1527. Patients With a Condition / LeetCode, SQL, MySQL

LearnerToRunner 2023. 3. 11. 01:28

문제

source: LeetCode
Write an SQL query to report 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.

 

 

 

 

제출답안(MySQL)

SELECT patient_id, patient_name, conditions
FROM patients
WHERE conditions REGEXP'^DIAB1|.* DIAB1|DIAB1$'

 

 

 

문제 바로가기(MySQL)

728x90
Comments