nerdexam
Oracle

1Z0-060 · Question #153

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 correct answer is D. INTERVAL DAY TO SECOND. INTERVAL DAY TO SECOND is the correct Oracle data type for storing a credit duration because it natively represents a time span in days and can be directly added to or subtracted from DATE values without any conversion functions.

Upgrading to Oracle Database 12c

Question

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?

Options

  • ADATE
  • BNUMBER
  • CTIMESTAMP
  • DINTERVAL DAY TO SECOND
  • EINTERVAL YEAR TO MONTH

How the community answered

(46 responses)
  • A
    4% (2)
  • B
    2% (1)
  • C
    9% (4)
  • D
    83% (38)
  • E
    2% (1)

Why each option

INTERVAL DAY TO SECOND is the correct Oracle data type for storing a credit duration because it natively represents a time span in days and can be directly added to or subtracted from DATE values without any conversion functions.

ADATE

DATE stores a specific point in time (year, month, day, hour, minute, second), not a duration or elapsed period, so it cannot represent 'number of days of credit.'

BNUMBER

NUMBER stores a plain numeric value and requires explicit conversion functions (such as adding a numeric value to a DATE) rather than being directly interoperable with date arithmetic.

CTIMESTAMP

TIMESTAMP stores a precise moment in time with fractional seconds and does not represent a duration between two points in time.

DINTERVAL DAY TO SECONDCorrect

The INTERVAL DAY TO SECOND data type stores a duration expressed in days, hours, minutes, and seconds, which means it directly satisfies the requirement for native DATE arithmetic without conversion functions. Oracle allows INTERVAL DAY TO SECOND values to be added to or subtracted from DATE columns, returning a DATE result natively, which supports both credit period calculations and per-day interest computations. It can represent any period up to the configured maximum number of days, easily accommodating the 30-day maximum requirement.

EINTERVAL YEAR TO MONTH

INTERVAL YEAR TO MONTH stores durations only in whole years and months and cannot represent day-level granularity, making daily interest calculations impossible.

Concept tested: Oracle INTERVAL DAY TO SECOND data type for duration storage

Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Data-Types.html#GUID-DC8AC4D6-C4F5-4436-8B24-E1D7839E3AF2

Topics

#INTERVAL data type#date arithmetic#data type selection#INTERVAL DAY TO SECOND

Community Discussion

No community discussion yet for this question.

Full 1Z0-060 Practice