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

Write a SELECT statement that returns these columns from the Orders table: The o

ID: 3556516 • Letter: W

Question

Write a SELECT statement that returns these columns from the Orders table:

The order_id column

The order_date column

The ship_date column

A column named days_to_ship that shows the number of days between the order_date and the ship_date

Add a WHERE clause that retrieves just the orders for March 2012 with a shipping date.

Here is what I came up with on my own:

SELECT order_id, order_date,
ship_date, (ship_date - order_date) AS 'days_to_ship'
FROM orders
WHERE MONTH(ship_date) = '3'
AND YEAR(ship_date) = '2012';

Explanation / Answer

Your query seems correct. All you need to chance is the format of Month and year in where clause.

Since they are not strings we use do not use apostrophe's.

Please find the below code that should solve your issue.Change made to the bold font

SELECT order_id, order_date,
ship_date, (ship_date - order_date) AS 'days_to_ship'
FROM orders
WHERE MONTH(ship_date) = 3
AND YEAR(ship_date) = 2012;

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