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 categoriesExplanation / 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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.