Formatting Date in SQL

Question:

Formatting Date

Write a query to display schedule id and date in the format of ‘YYYY-MM-DD’ and name the column as FormattedDate. Display record in ascending order by schedule id.

Quiz for Exam - Formatting Date

Code:

Main.sql

select schedule_id, to_char(travel_date, 'YYYY-MM-DD') as FormattedDate 
from schedule 
order by schedule_id;

Recommended:

Leave a Comment

Your email address will not be published. Required fields are marked *

x