Question

2) Write a SELECT statement that returns these columns from the DATE_SAMPLE table int EX database....

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.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

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

  

Add a comment
Know the answer?
Add Answer to:
2) Write a SELECT statement that returns these columns from the DATE_SAMPLE table int EX database....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a SELECT statement that returns these columns from the INVOICES table: the invoice_total column, a...

    Write a SELECT statement that returns these columns from the INVOICES table: the invoice_total column, a column that uses the ROUND function to return the invoice_total column with 1 decimal digit, a column that uses the ROUND function to return the invoice_total column with no decimal digits, a column that uses TRUNCATE function tom return the invoice_total column with no decimal digits.

  • and blankS iI a SELECT statement that returns these columns from the Invoices Write table 4....

    and blankS iI a SELECT statement that returns these columns from the Invoices Write table 4. The invoice number column The invoice date column The invoice_date column plus 30 days The payment_date column A column named days_to_pay that shows the number of days between the invoice date and the payment date The number of the invoice date's month The four-digit year of the invoice date When you have this working, add a WHERE clause that retrieves just the invoices for...

  • 13. Write a SELECT statement without a FROM clause that uses the CURRENT_DATE function to return...

    13. Write a SELECT statement without a FROM clause that uses the CURRENT_DATE function to return the current date in its default format. Use the DATE_FORMAT function to format the current date in this format: mm-dd-yyyy This displays the month, day, and four-digit year of the current date. Give this column an alias of current_date. To do that, you must enclose the alias in quotes since that name is already used by the CURRENT_DATE function.

  • Can someone solve it with C plz Write a program that inputs a time from the...

    Can someone solve it with C plz Write a program that inputs a time from the console. The time should be in the format “HH:MM AM” or “HH:MM PM”. Hours may be one or two digits, for example, “1:10 AM” or “11:30 PM”. Your program should include a function that takes a string parameter containing the time. This function should convert the time into a four digit military time based on a 24 hour clock. For example, “1:10 AM” would...

  • 5. Write a SELECT statement that returns these columns from the Orders table: OrderID OrderDate ShipDate...

    5. Write a SELECT statement that returns these columns from the Orders table: OrderID OrderDate ShipDate Return only the rows where the ShipDate column contains a null value. 6. Write a SELECT statement that returns all columns from the Addresses table State is equal to CA 7. Write a SELECT statement that returns all columns from the Products table Product name has a "ru" in its name 8. Write a SELECT statement that returns these columns from the Customers table...

  • Write a C/C++ program that determines exactly how many hours have passed since a previous historical...

    Write a C/C++ program that determines exactly how many hours have passed since a previous historical event happened. For example, if the user entered the hour and date of the historical event (including the time of day in military format, the month in string format, the day of the month in integer format and year in 4 digit format); then your program would calculate the number of hours between then and the present time. No you should take into account...

  • Problem 1 (Reading Statistics) Write a function called read_stats(filename) that takes a csv (comma separated values)...

    Problem 1 (Reading Statistics) Write a function called read_stats(filename) that takes a csv (comma separated values) filename as an argument and returns a 2D list containing the statistics in that file. The returned list should contain lists of stats for each crime reported and should not include the header line from the file. The file crime_in_vancouver.csv (included in the folder) has the following structure: • The first row provides headers for each column • Each subsequent row represents the stats...

  • CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write...

    can i get some help with this program CMPS 12B Introduction to Data Structures Programming Assignment 2 In this project, you will write a Java program that uses recursion to find all solutions to the n-Queens problem, for 1 Sns 15. (Students who took CMPS 12A from me worked on an iterative, non-recursive approach to this same problem. You can see it at https://classes.soe.ucsc.edu/cmps012a/Spring l8/pa5.pdf.) Begin by reading the Wikipcdia article on the Eight Queens puzzle at: http://en.wikipedia.org/wiki/Eight queens_puzzle In...

  • Please write an 1. executive overview of the above case study. 2. in detail, what is...

    Please write an 1. executive overview of the above case study. 2. in detail, what is the critical issue or problem in the above case study. 3. please provide a detailed analysis of the cause of the issue or problem in the above case study. 國connect VIDEO CASE 1 Chobani: Making Greek Yogurt a Household Name Everybody should be able to enjoy a pure, simple cup of yogurt. And that's what Chobani is," says The very first cup for sale...

  • Case 2: Going to The X-Stream Gil Reihana is the chief executive officer of X-Stream, an...

    Case 2: Going to The X-Stream Gil Reihana is the chief executive officer of X-Stream, an Auckland-based company that assembles personal computers for the New Zealand and Australian markets, and sells them through a number of chain stores and independent retailers. He started the company six years ago, at the age of 25, after graduating from university with a Bachelor’s degree in Information Technology and Management. To establish the company, Reihana invested $300 000 he had inherited and persuaded various...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT