Loading Consent Dialog
SQL Functions   «Prev 

SQL Date Functions - Exercise

Objective: Create a SELECT statement that will translate several date values by using date functions.
Given a table named MyTable with a date-formatted column named MyDate, create select statements that will do the following. The correct results should be presented as three separate SQL statements.
  1. Select the current date values from the table in one column, and show a new column that will include the date incremented by 3 weeks.
  2. Select the values in the MyDate column and return the difference between those dates and today, assuming you can use the GETDATE function to determine today's date. Show the difference in days.
  3. Query the table and find out what month of the year it is (i.e., the third month) for each value in the MyDate column.