본문 바로가기

데이터 분석68

185. Department Top Three Salaries (LeetCode) Department Top Three Salaries - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com A high earner in a department is an employee who has a salary in the top three unique salaries for that department. Write an SQL query to find the employees who are high earners in each of the departmen.. 2022. 9. 26.
The Report (HackerRank) The Report | HackerRank Write a query to generate a report containing three columns: Name, Grade and Mark. www.hackerrank.com Ketty gives Eve a task to generate a report containing three columns: Name, Grade and Mark. Ketty doesn't want the NAMES of those students who received a grade lower than 8. The report must be in descending order by grade -- i.e. higher grades are entered first. If there .. 2022. 9. 20.
Challenges (HackerRank) Challenges | HackerRank Print the total number of challenges created by hackers. www.hackerrank.com Write a query to print the hacker_id, name, and the total number of challenges created by each student. Sort your results by the total number of challenges in descending order. If more than one student created the same number of challenges, then sort the result by hacker_id. If more than one stude.. 2022. 9. 19.
184. Department Highest Salary (LeetCode) Department Highest Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Write an SQL query to find employees who have the highest salary in each of the departments. 풀이 제출한 답 select d.name as department, e.name as employee, e.salary as salary from employee as e join department a.. 2022. 9. 18.
Top Earners (HackerRank) Top Earners | HackerRank Find the maximum amount of money earned by any employee, as well as the number of top earners (people who have earned this amount). www.hackerrank.com We define an employee's total earnings to be their monthly worked, and the maximum total earnings to be the maximum total earnings for any employee in the Employee table. Write a query to find the maximum total earnings fo.. 2022. 9. 17.
[SQL] with절과 서브쿼리 부제: 서브쿼리가 너무 싫어서 서브쿼리 안 쓰는 방법을 필사적으로 찾아봄 서브쿼리를 작성할 때 밑에서부터 타고 올라가다 보니 내가 어디까지 정의했는지 헷갈린 적이 많았다. 그보다 더 심각한 건 다른 사람이 작성한 쿼리를 파악할 때인데 쿼리문의 중간 어드메 그 뿌리를 찾아가는게 너무 괴로운 경험이었다. 그래서 도대체 왜 with절을 안 쓰고 서브쿼리를 쓰는지,,, 크게 두 가지 의문이 들었다. with절과 서브쿼리, 어떤 차이가 있는지? 일단 서브쿼리 자체는 세 종류이다. select절, from절, where절에 위치하고 각각 컬럼처럼, 테이블처럼, 조건의 value처럼 사용된다. 이 중에서도 with절과 쓰임이 같은 것은 from절 서브쿼리이다. 그래서 내가 의문을 가진 부분도 from절 서브쿼리에 해.. 2022. 9. 16.
196. Delete Duplicate Emails (LeetCode) Delete Duplicate Emails - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Write an SQL query to delete all the duplicate emails, keeping only one unique email with the smallest id. Note that you are supposed to write a DELETE statement and not a SELECT one. 풀이 제출한 오답 delete from Pe.. 2022. 9. 16.
627. Swap Salary (LeetCode) Swap Salary - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com Write an SQL query to swap all 'f' and 'm' values (i.e., change all 'f' values to 'm' and vice versa) with a single update statement and no intermediate temporary tables. 풀이 제출한 답 UPDATE SALARY SET SEX = CASE WHEN SEX = .. 2022. 9. 15.
사용자 행동 데이터 설계/분석 현실 레슨 런 데이터 쌓은 거 있어요? 아니 없어요 쓸만한 데이터가 하나도 없어요? 없어요 아 있었는데? 아니 없어요 그냥 데이터를 기반으로 서비스를 개선해 나가는 것은 누구나 꿈꾸는 일이지만 경험해보니 생각보다 녹록치 않다. 일단 위 사례처럼 쌓아 놓은 데이터 자체가 없는 경우가 많다. 그래서 대부분 행동 로그라고도 부르는 사용자 행동 데이터부터 쌓기 시작할 것이다. 그런데 이 사용자 행동 데이터는 데이터량이 방대하고 결과물이 raw 데이터에 가깝기 때문에 설계 및 분석이 까다롭다. 설계 방법론에 대해 참고할 만한 글은 많은 것 같아서 나는 사용자 행동 데이터 설계/분석 등에 대한 현실 레슨런에 대해 남겨보려고 한다. 닭이 먼저냐 달걀이 먼저냐, 데이터가 먼저냐 서비스가 먼저냐 앞서 언급한 ‘데이터 기반의 서비스 개.. 2022. 9. 10.
코호트-리텐션 분석(2) - SQL을 활용하여 코호트 분석하기 코호트-리텐션 분석(1) - 엑셀을 활용하여 코호트 분석하기를 먼저 보면 좋습니다 코호트-리텐션 분석(1) - 엑셀을 활용하여 코호트 분석하기 코호트 분석과 리텐션 분석이 뭐가 다른지도 모르던 시절.. 멋들어진 그라데이션 차트를 그려보겠다는 일념으로 엑셀로 코호트 차트 그리기에 도전했다. 이 글은 근성의 엑셀 함수를 거쳐 SQL로 hyeyun133.tistory.com 2. SQL을 활용하여 코호트 분석하기 SQL을 활용한 코호트 분석은 데이터리안 SQL 데이터 분석 캠프 실전반을 수강하며 배운 내용을 응용했다. 강의에서는 sqlsolve US E-commerce Records 2020 데이터를 활용했지만 이번에도 누가, 언제, 무엇을 했는지에 대한 raw 데이터만 있으면 가능하다. Step 1. Raw.. 2022. 8. 30.