SQL Functions   «Prev 

SQL Date Functions - Exercise

Database: Oracle AI Database 26ai. Write your answer using the table and column names supplied below.

Objective: Add an interval, count date boundaries, and extract a month.

Assume MyTable contains a MyDate column of Oracle DATE type. Write three SELECT statements:

  1. Return MyDate and a second column that adds three weeks to it.
  2. Return MyDate and the number of DAY boundaries from the current database date/time (SYSDATE) to MyDate. A later MyDate should give a positive count.
  3. Return MyDate and its numeric month (1 through 12).

Give each calculated column a meaningful alias. Use Oracle 26ai DATEADD, DATEDIFF, and EXTRACT. These DATEADD and DATEDIFF examples are version-specific and should not be assumed to work on older Oracle installations.

For a fixed check, replace SYSDATE with DATE '2026-10-01' and use MyDate = DATE '2026-10-08'. Predict all three calculated values. Also explain why a day-boundary count is different from complete 24-hour periods.

How to submit: Enter your SQL and reasoning, then select Submit to compare with the model solution. This is a self-assessment: the website does not connect to a database or execute your SQL.