티스토리 뷰
1️⃣ 멘토링 짝꿍 리스트
Q1. https://solvesql.com/problems/mentor-mentee-list/
solvesql
© Copyright 2021-2022 solvesql.com
solvesql.com
select
e1.employee_id as mentee_id,
e1.name as mentee_name,
e2.employee_id as mentor_id,
e2.name as mentor_name
from employees e1, employees e2
where
e1.join_date between '2021-09-01' and '2021-12-31'
and e2.join_date <= '2019.12.31'
and e1.department != e2.department
order by
mentor_id
2️⃣ 데이터 그룹으로 묶기
Q2. https://solvesql.com/problems/group-by/
solvesql
© Copyright 2021-2022 solvesql.com
solvesql.com
SELECT quartet
, round(avg(x),2) AS x_mean
, round(variance(x),2) AS x_var
, round(avg(y),2) AS y_mean
, round(variance(y),2) AS y_var
FROM points
GROUP BY quartet;
3️⃣ Exchange Seats
Q3. https://leetcode.com/problems/exchange-seats/
Exchange Seats - 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
-- 1번 풀이
SELECT CASE
WHEN MOD(id,2) = 0 THEN id - 1
WHEN MOD(id,2) = 1 AND id < (SELECT COUNT(*) FROM seat) THEN id + 1
ELSE id END AS id
, student
FROM seat
ORDER BY id;
-- 2번 풀이
SELECT ROW_NUMBER() OVER() AS id, student
FROM seat
ORDER BY CASE WHEN MOD(id, 2) = 1 THEN id + 1 ELSE id - 1 END;
4️⃣ Customers Who Never Order
Q4. https://leetcode.com/problems/customers-who-never-order/
Customers Who Never Order - 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
SELECT name AS Customers
FROM customers LEFT JOIN orders o ON customers.id = o.customerId
WHERE o.id is null
5️⃣ Not Boring Movies
Q5. https://leetcode.com/problems/not-boring-movies/
Not Boring Movies - 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
SELECT *
FROM Cinema
WHERE id % 2 = 1
AND description NOT LIKE '%boring%'
ORDER BY rating DESC
'Data Analystics > SQL' 카테고리의 다른 글
[SQL] Yammer 검색 기능 개선방향 분석(Log, Session 구간 설정) (0) | 2022.03.26 |
---|---|
[SQL] Yammer 유저 인게이지먼트 하락 원인 분석 (0) | 2022.03.26 |
주간 SQL Study 5차시 (SolveSQL, programmers 문제풀이) (0) | 2022.03.16 |
주간 SQL Study 4차시 (Group by, Select, Join 문제풀이) (0) | 2022.03.13 |
주간 SQL Study 3차시 (SolveSQL, LeetCode 문제풀이) (0) | 2022.03.09 |
- Total
- Today
- Yesterday
- 힙데비
- 이단자
- 비저블
- SQL
- 비즈니스케이스
- leetcode
- subqeury
- 피터 드러커
- SolveSQL
- SQL Study
- 최고의 질문
- 1기
- SQL Cheet Sheet
- 사이드프로젝트
- 데이터농장팀
- 데이터분석
- 비즈니스특강
- 지표설정
- Sqlstudy
- 개소리엔냥소리로
- 프로그래머스
- Vizable
- 비즈니스케이스분석
- Tableau
- 비즈니스케이스스터디
- 농넷
- 멤버십분석
- 메스프레소
- 삶이 던지는 질문은 언제나 같다
- 222문222답
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |