2025/02/17 6

[MySQL][Leet Code] 197. Rising Temperature (Easy)

https://leetcode.com/problems/rising-temperature/description/?envType=study-plan-v2&envId=top-sql-50 🗒️SQL 코드 풀이 SELECT idFROM Weather W1 INNER JOIN ( SELECT DATE_ADD(recordDate, INTERVAL 1 DAY) recordDate2, temperature FROM Weather ) W2 ON W1.recordDate = W2.recordDate2WHERE W1.temperature - W2.temperature > 0 1. 문제에서 요구하는 것은 간단하다. 전날과 비교해서 기온이 떨어지는 id를 출력하는 것이다. 2. ..

[MySQL][Leet Code] 1581. Customer Who Visited but Did Not Make Any Transactions (Easy)

https://leetcode.com/problems/customer-who-visited-but-did-not-make-any-transactions/description/?envType=study-plan-v2&envId=top-sql-50🗒️SQL 코드 풀이 SELECT customer_id, COUNT(*) count_no_trans FROM Visits v LEFT JOIN Transactions t ON v.visit_id = t.visit_idWHERE t.visit_id IS NULLGROUP BY customer_id 1. LEFT JOIN을 하고 , visit_id 컬럼이 2개가 나오는데, 그 중 Transactions의 컬럼의 visit_id 의 NULL 값을 조회한다. 2. 이후 ..

[MySQL][Leet Code] 1378. Replace Employee ID With The Unique Identifier (Easy)

https://leetcode.com/problems/replace-employee-id-with-the-unique-identifier/description/?envType=study-plan-v2&envId=top-sql-50https://leetcode.com/problems/article-views-i/?envType=study-plan-v2&envId=top-sql-50🗒️SQL 코드 풀이 1SELECT unique_id , nameFROM Employees e LEFT JOIN EmployeeUNI eu ON e.id = eu.id 1. 간단한 JOIN 문제로 먼저 가져올 테이블 Employee를 선택한다. 2. 이후 EmployeeUNI와 JOIN을 하는데, id를 기준으로 해준다.  📌..

[MySQL][Leet Code] 1148. Article Views I (Easy)

https://leetcode.com/problems/find-customer-referee/description/?envType=study-plan-v2&envId=top-sql-50https://leetcode.com/problems/article-views-i/?envType=study-plan-v2&envId=top-sql-50🗒️SQL 코드 풀이 1SELECT DISTINCT author_id AS id FROM ViewsWHERE author_id = viewer_idORDER BY id 1. 간단한 SQL 문제이다.  먼저 가져올 테이블 Views를 선택한다. 2. 이후 author_id와 viewer_id가 같은 조건을 걸어준다 . 3. 선택 할 컬럼은 author_id이로 Alias는 ..

[1분 면접] 스레드, 프로세스, 코어의 수는 많을 수록 좋을까 ?

코어가 많은 경우많은 코어는 CPU의 병렬 처리 성능을 향상이를 최대한 활용하기 위해서는 소프트웨어가 멀티코어 환경에 최적화되어야 함단일 스레드 작업이 주를 이룰 경우, 추가 코어의 이점을 잘 활용 못함또한 코어 수가 많아질수록 CPU의 비용과 전력 소비가 증가해 발열 관리 복잡 프로세스가 많은 경우각 프로세스는 독립된 메모리 공간을 가지는데, 프로세스가 동시에 실행되면 메모리 사용량 급격히 증가프로세스 생성 및 관리에도 많은 시스템 자원이 소모 IPC (프로세스 간 통신)이 필요한 경우 성능 저하 발생많은 프로세스는 프로세스 간 Context Switching에 발생하는 오버헤드 수반 스레드가 많은 경우스레드가 많아지면, 스레드 간 Context Switching이 자주 일어나 CPU 자원이 스레드 관..