0523 til

looggi·2023년 5월 23일
0

TILs

목록 보기
76/114
post-thumbnail

못풀었던 문제 풀고 자기

SQL 문제 풀기

SELECT C.CAR_ID, C.CAR_TYPE, FLOOR(30*C.DAILY_FEE*(100-DISCOUNT_RATE)/100) AS FEE
FROM CAR_RENTAL_COMPANY_CAR C
JOIN CAR_RENTAL_COMPANY_RENTAL_HISTORY CH
ON C.CAR_ID=CH.CAR_ID
JOIN CAR_RENTAL_COMPANY_DISCOUNT_PLAN CP
ON C.CAR_TYPE=CP.CAR_TYPE
WHERE C.CAR_TYPE IN ('세단','SUV')
AND CH.START_DATE > 2022-11-30  OR CH.END_DATE < 2022-11-01
AND CP.DURATION_TYPE ='30일 이상'
AND 30*C.DAILY_FEE*(100-DISCOUNT_RATE)/100 BETWEEN 500000 AND 1999999
GROUP BY C.CAR_ID
ORDER BY FEE DESC, C.CAR_TYPE ASC, C.CAR_ID DESC
profile
looooggi

0개의 댓글