2024/06 3

1527. Patients With a Condition

https://leetcode.com/problems/patients-with-a-condition/description/ replace, substring, concat, left, right, lower, upper, trim, length, format, instr 정도만 알아도 SQL 데이터 변형에 큰 문제가 없겠지만, Regex 문법 까지 익숙해지면 빠른 전처리에 큰 도움이 될 것 같다.   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 r..

1251. Average Selling Price

https://leetcode.com/problems/average-selling-price/description/ 15번째 케이스에서 Prices 테이블의 product_id가 3이상으로 추가되면서, UnitSold 테이블에 없는 데이터 값도 결과값에 으로 나타나야 했기에 INNER 를 LEFT로 수정하고,조건 결과값으로, Null값도 함께 나타날 수 있도록 WHERE문 끝에 "or UnitsSold.product_id IS NULL" 을 이어붙인 뒤 COALESCE를 ROUND 앞에 씌워 NULL값 처리를 해야했다.   잠깐 생각하게 만들었던 문제다음부턴 예시에 보이지 않는 테스트 케이스를 예상해서 작성해봐야겠다. *** JOIN에 AND 조건을 덧붙이는 방식보다, WHERE로 조건을 추가 작성하는 ..