SQL query question.

Asked 2 years ago, Updated 2 years ago, 49 views

On the reservation table, there are columns such as SYSDATE, rental fee, rental date, return date, payment amount, and final payment amount. When the rental fee is 30,000 won per day, When I rented it for five days, Can I know the query that asks for 150,000 won for the final payment price?

Reservation date = current time

Rental Date = DATE EX// 2020-04-22

Return Date = DATE EX// 2020-04-27 : Borrow 5 days

Rental fee: KRW 30,000

Final payment amount: KRW 150,000

I want to be like this

oracle sql

2022-09-21 10:40

1 Answers

SELECT EXTRACT(DAY FROM B) - EXTRACT(DAY FROM A) FROM DUAL

Write the EXTRACT function.


2022-09-21 10:40

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.