Today I Learn
: SQL 코드카타, Python 강의
- SQL 코드카타
- 문제 1 (#39)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/133026
2. 정답 코드:
select i.ingredient_type, sum(f.total_order) as total_order
from icecream_info i
join first_half f
on i.flavor = f.flavor
group by i.ingredient_type
order by sum(f.total_order) asc
- 문제 2 (#44)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/131530
2. 정답 코드:
select
case
when price < 10000 then 0
when price < 20000 then 10000
when price < 30000 then 20000
when price < 40000 then 30000
when price < 50000 then 40000
when price < 60000 then 50000
when price < 70000 then 60000
when price < 80000 then 70000
when price < 90000 then 80000
else 90000 end as price_group,
count(distinct product_id) as products
from product
group by 1
order by 1 asc
- 문제 3 (#46)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/157341
2. 정답 코드:
select distinct c.car_id
from car_rental_company_car c
join car_rental_company_rental_history h
on c.car_id = h.car_id
where c.car_type = '세단'
and h.start_date like '2022-10%'
order by c.car_id desc
- 문제 4 (#52)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/133025
2. 정답 코드:
select f.flavor
from first_half f
join icecream_info i
on f.flavor = i.flavor
where i.ingredient_type = 'fruit_based'
group by f.flavor
having sum(f.total_order) > 3000
order by sum(f.total_order) desc
- 문제 5 (#53)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/131536
2. 정답 코드:
select user_id, product_id
from online_sale
group by user_id, product_id
having count(distinct sales_date) >= 2
order by user_id asc, product_id desc
- 문제 6 (#57)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/164672
2. 정답 코드:
select board_id, writer_id, title, price,
case status
when 'SALE' then '판매중'
when 'RESERVED' then '예약중'
when 'DONE' then '거래완료' end as status
from used_goods_board
where created_date = '2022-10-05'
order by board_id desc
- 문제 7 (#72)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/164673
2. 정답 코드:
select b.title, b.board_id, r.reply_id, r.writer_id, r.contents,
date_format(r.created_date,'%Y-%m-%d') as created_date
from used_goods_board b
join used_goods_reply r
on b.board_id = r.board_id
where b.created_date like '2022-10%'
order by created_date asc, title asc
- 문제 8 (#31)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/59044
2. 정답 코드:
select i.name, i.datetime
from animal_ins i
left join animal_outs o
on o.animal_id = i.animal_id
where o.animal_id is null
order by i.datetime asc
limit 3;
3. 오류 상황: where이 아닌 on 절에 and로 연결해서 o.animal_id is null 이라고 작성함. null 이 남아있기 위해선 on-and 사용해야한다고 잘못 생각함!
4. 시도 방법: GEMINI 질문 & TIL 에서 해당 부분 검색
5. 최종 문제 해결 방법: TIL 에서 검색한 내용 제대로 읽고 이해해서 수정함


출처 : https://myun0506.tistory.com/17
20251230 TIL
Today I Learn: SQL 4회차 세션 복습 후 과제 제출, SQL 사전 퀘스트 달리기반, 코드카타, 온라인 세션 - 문길래 튜터님 - SQL 세션 4회차 (코드: https://github.com/rladbstj56/2025_main_bootcamp/blob/main/SQL_session/251229_
myun0506.tistory.com
- 문제 9 (#38)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/131113
2. 정답 코드:
select
order_id, product_id,
date_format(out_date,'%Y-%m-%d'),
case when out_date <= "2022-05-01" then "출고완료"
when out_date > "2022-05-01" then "출고대기"
else "출고미정" end as "출고여부"
from food_order
order by order_id asc
- 문제 10 (#43)
1. 문제 링크: https://school.programmers.co.kr/learn/courses/30/lessons/164668
2. 정답 코드:
select u.user_id, u.nickname, sum(b.price) as total_sales
from used_goods_user u
join used_goods_board b
on u.user_id = b.writer_id
where b.status = "DONE"
group by u.user_id, u.nickname
having sum(b.price) >= 700000
order by sum(b.price) asc
- 파이썬 공부
- 프로그램 종료 함수
https://myun0506.tistory.com/28
프로그램 종료 함수
- 프로그램 종료 함수sys.exit([arg]) (가장 권장되는 방법)호출 시 SystemExit 예외 발생인자: 0은 정상종료, 그 외의 숫자(보통 1)는 에러로 인한 비정상 종료를 의미os._exit(n) (즉시 강제 종료)프로세스
myun0506.tistory.com
- 세 변수를 비교하기
https://myun0506.tistory.com/29
if 조건문 활용, while 절 활용, 연산자 비교 우선순위, 단락평가
- if문 조건문 활용continue :해당 반복문을 빠져나와 다음 반복을 거침pass : 해당 반복문에 그대로 남아서 아래 있는 실행문을 모두 거친 후 다음 반복을 거침cnt = 0for i in range(1,11): if i % 2 == 0: pass pr
myun0506.tistory.com
- 타입 힌트
- is 연산자 vs == 연산자
https://myun0506.tistory.com/36
타입 힌트, is 연산자 vs == 연산자
- 타입 힌트Python 에서는 강제성 없음. 힌트(주석)일 뿐C나 Java에서는 선언한대로만 인자를 넣어야하고 타입이 선언된 것과 달리 들어가면 컴파일 에러 발생isinstance의 함정bool 타입은 int의 서브클
myun0506.tistory.com
- Mutable vs Immutable
https://myun0506.tistory.com/31
가변 (Mutable) vs 불변 (Immutable)
- 가변 (mutable) 객체와 불변 (immutable) 객체의 차이append()는 in-place 수정리스트는 가변 객체이므로 append()가 리스트 자체를 직접 수정함data = []print(id(data)) # 메모리 주소: 예) 140234567891234data.append("A")
myun0506.tistory.com
- 할당 vs 얕은 복사 vs 깊은 복사
https://myun0506.tistory.com/27
할당 vs 얕은 복사 vs 깊은 복사 / In-place 제자리 수정 vs Out-of-place 외부 생성
- 할당 vs 얕은 복사 vs 깊은 복사얕은 복사객체의 최상위 레벨만 복사하고, 그 안에 포함된 하위 객체들은 원본 객체와 참조를 공유함깊은 복사객체와 그 안에 포함된 모든 하위 객체까지 재귀적
myun0506.tistory.com
- 파이썬 무한 정수의 비밀 (int 자료형의 범위에 제한이 없음)
- 정적할당 vs 동적할당
https://myun0506.tistory.com/37
정적 할당과 동적 할당 / 파이썬 int 자료형 범위
- 파이썬 무한 정수의 비밀 (int 자료형의 범위에 제한이 없음) C나 Java같은 다른 언어는 고정 정밀도 산술 (Fixed-precision arithmetic) 하드웨어(CPU)의 레지스터 크기에 맞춰 데이터를 처리하기 때문에
myun0506.tistory.com
- pass 구문
x = 10
if x > 0:
pass # 조건이 True지만 아무 동작도 하지 않음
else:
print("0 이하입니다.")
- for 반복문
- range()
- 반복문 제어문
- enumerate()
- zip()
https://myun0506.tistory.com/29
if 조건문 활용, while 절 활용, 연산자 비교 우선순위, 단락평가
- if문 조건문 활용continue :해당 반복문을 빠져나와 다음 반복을 거침pass : 해당 반복문에 그대로 남아서 아래 있는 실행문을 모두 거친 후 다음 반복을 거침cnt = 0for i in range(1,11): if i % 2 == 0: pass pr
myun0506.tistory.com
- 실습 문제 1: 약수 구하기
n = int(input("정수를 입력하세요"))
yak = []
for i in range(n,0,-1):
if n%i == 0:
yak.append(int(n/i))
else:
continue
print(f"{n}의 약수: ",end=' ')
for i in yak:
print(i,end=" ")
- 실습 문제 2: 문자열 뒤집기
word = input("문자열을 입력하세요: ")
# 1번째 방법
length = len(word)
for i in range(length):
print(word[length-i-1],end='')
print()
# 2번째 방법
result = ""
for w in word:
result = w + result
print(result)
- 실습 문제 3: 숫자 맞히기 게임
import random
answer = random.randint(1,10)
while True:
guess = int(input("정수를 입력하세요 (1~10): "))
if guess == answer:
print("정답입니다!")
break
else:
print("틀렸습니다. 다시 입력하세요.")
continue
- 아티클 스터디
( https://yozm.wishket.com/magazine/detail/1070/ )



- SQL 성취도 평가 피드백




'[데이터분석] 부트캠프 TIL' 카테고리의 다른 글
| 20260109 TIL (1) | 2026.01.09 |
|---|---|
| 20260108 TIL (0) | 2026.01.08 |
| 20260106 TIL (0) | 2026.01.06 |
| 20260105 TIL (0) | 2026.01.05 |
| 20260102 TIL (1) | 2026.01.02 |