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

2) Write a SELECT statement that returns these columns from the DATE_SAMPLE tabl

ID: 3706435 • Letter: 2

Question

2) Write a SELECT statement that returns these columns from the DATE_SAMPLE table int EX database. The start_date column. A column that uses the DATE_FORMAT function to return the start_date column with its month name abbreviated and its month, day and two-digit year separated by slashes. A column that uses the DATE_FORMAT function to return the start_date column with its month and day returned as integers with no leading zeros, a two-digit year and all date parts separated by slashes. A column that uses the DATE_FORMAT function to return the start_date column with only the hours and minutes on a 12-hour clock with an am/pm indicator. A column that uses the DATE_FORMAT function to return the start_date column with its month returned as an integer with no leading zeros, its month, day and two-digit year separated by slashes, and its hours and minutes on a 12-hour clock with an am/pm indicator.

I don't need seperate statements/query's it needs to be one singular query.

Explanation / Answer

Below is the query:

SELECT
DATE_FORMAT(start_date, "%b/%d/%y"),
DATE_FORMAT(start_date, "%c/%e/%y"),
DATE_FORMAT(start_date, "%h:%i %p"),
DATE_FORMAT(start_date, "%c/%e/%y %h:%i %p")
from EX.DATE_SAMPLE;  

Explanation:

We have used DATE_FORMAT function to get the different formats.

Sample output:

Since i do not have the schema that you are reffering to, I have used current_timestamp to produce the output.

  

DATE_FORMAT(current_timestamp, "%b/%d/%y") DATE_FORMAT(current_timestamp, "%c/%e/%y") DATE_FORMAT(current_timestamp, "%h:%i %p") DATE_FORMAT(current_timestamp, "%c/%e/%y %h:%i %p") Apr/12/18 4/12/18 07:28 PM 4/12/18 07:28 PM
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