Which data type would you use for such a column in the table?

You need to create a table for a banking application. One of the columns in the table has the following
requirements:
1) You want a column in the table to store the duration of the credit period.
2) The data in the column should be stored in a format such that it can be easily added and subtracted with
DATE data type without using conversion functions.
3) The maximum period of the credit provision in the application is 30 days.
4) The interest has to be calculated for the number of days an individual has taken a credit for.
Which data type would you use for such a column in the table?

You need to create a table for a banking application. One of the columns in the table has the following
requirements:
1) You want a column in the table to store the duration of the credit period.
2) The data in the column should be stored in a format such that it can be easily added and subtracted with
DATE data type without using conversion functions.
3) The maximum period of the credit provision in the application is 30 days.
4) The interest has to be calculated for the number of days an individual has taken a credit for.
Which data type would you use for such a column in the table?

A.
DATE

B.
NUMBER

C.
TIMESTAMP

D.
INTERVAL DAY TO SECOND

E.
INTERVAL YEAR TO MONTH



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Eric Sacramento

Eric Sacramento

It just to ilustrate one example !! 😀

SELECT SYSDATE – INTERVAL ‘3 12:30:06.7’ DAY TO SECOND(1)
FROM dual;

LeelaPavanKumar

LeelaPavanKumar

why not option C?
i think timestamp also correct

davor

davor

Because on of the requirements: ‘The data in the column should be stored in a format such that it can be easily added and subtracted with
DATE data type […]’

Subtracting TIMESTAMP with DATE = INTERVAL…

Teresa Aromatico

Teresa Aromatico

Why not option B?

Fabio

Fabio

Because if you have only days is the same but if you store even hours, minutes and seconds you can’t simply add or subtract from a date.

Teresa Aromatico

Teresa Aromatico

thank you Fabio