41.2k views
4 votes
Display the order date and the ship date for all orders that were made April 1 through April 15. List the order date, ship date, order priority, and ship mode. Order the results by order_date. Do you notice anything unusual about the data? [Hint: You will need to join the orders and shipping together and use a join statement. You will need to limit the result set by the date field order_date <= to_date('04/15/2018', 'mm/dd/yyyy')This is what I was able to come up with but it still gave me an error.select orders.order_date, shipping.ship_date, orders.order_priority, shipping.ship_modefrom ordersinner join shipping on orders.order_date = shipping.ship_datewhere Orders.Order_date = Shipping.ship_date AND Order_Date BETWEEN TO_DATE (’04/01/2018’, ‘04/15/2018’)ORDER BY Order_Date;

User Badr Hari
by
5.3k points

1 Answer

7 votes

Answer:

SELECT Order_date, Ship_Date, Order_priority, Ship_mode

FROM orders

JOIN Shipping ON Orders.Order_id = Shipping.Order_id

WHERE Order_date

BETWEEN TO_DATE('04/01/2018', '%m/%d/%Y') AND TO_DATE('04/15/2018', '%m/%d/%Y')

ORDER BY Order_date

Step-by-step explanation:

The SQL statement above queries a database with four tables shipping, orders, market and product. The query returns four columns from two tables orders and shipping, returning only rows with order dates between April 1 and April 15 of 2018. The tables are joined with the primary key order_id and the dates are parsed with the to_date function. The result is also ordered by the order_date

User Medjine
by
6.8k points