Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

10. Write a SELECT statement that returns these columns from the Products table:

ID: 3851308 • Letter: 1

Question

10. Write a SELECT statement that returns these columns from the Products table:

The date_added column

A column that uses the CAST function to return the date_added column with

its date only (year, month, and day)

A column that uses the CAST function to return the date_added column with

just the year and the month

A column that uses the CAST function to return the date_added column with

its full time only (hour, minutes, and seconds)

products v Columns product id category id product code product name description st price discount percent date added v Indexes PRIMARY product code products fk categories Foreign Keys products fk categories

Explanation / Answer

When date column is encountered oracle uses TO_Char function to format the result with default format. We can overwrite TO_Char function as follows to get the desired output

SELECT TO_CHAR(date_added,'YYYY/MM'),TO_CHAR(date_added,'YYYY/MM'),TO_CHAR(date_added,'HH:MM:SS') from movies

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote