Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨[22.02.24] Day 9 #25

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions 형민/day_9.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
1번 : 특정 옵션이 포함된 자동차 리스트 구하기

- SELECT HISTORY_ID, CAR_ID, DATE_FORMAT(START_DATE, '%Y-%m-%d') as 'START_DATE', DATE_FORMAT(END_DATE, '%Y-%m-%d') as 'END_DATE',
CASE
WHEN DATEDIFF(END_DATE, START_DATE) >= 29 THEN '장기 대여'
ELSE '단기 대여'
END as 'RENT_TYPE'
FROM CAR_RENTAL_COMPANY_RENTAL_HISTORY
WHERE year(START_DATE) = '2022' and MONTH(START_DATE) = '09'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

date_format 으로 한번에 자를수도 있습니다!
제 커밋 참고해보시죠:)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

매우 좋은 방법이네요 참고하겠습니다!

ORDER BY HISTORY_ID DESC

2번 : 자동차 대여 기록에서 장기/단기 대여 구분하기

- SELECT CAR_ID, CAR_TYPE, DAILY_FEE, OPTIONS
FROM CAR_RENTAL_COMPANY_CAR
WHERE OPTIONS LIKE '%네비게이션%'
ORDER BY CAR_ID DESC