Question: Write the SQL code to display all the columns and rows/records in the Orders table Write the SQL code to display the order_id, customer_id and

  1. Write the SQL code to display all the columns and rows/records in the Orders table
  2. Write the SQL code to display the order_id, customer_id and the order_date for all orders.
  3. Write the SQL code to display the order_id, customer_id and order_date for all orders but order the results by order_date in ascending order.
  4. Write the SQL code to display the order_id of all of the orders that have been shipped. (Please look at the data in the Orders table to figure out how to identify if an order has been shipped.Also, watch my video above for a hint)
  5. Write the SQL code to display the order_id of all orders that have the status 1
  6. Write the SQL code to display the customer_id for all customers who have placed orders (If a customer has placed more than one order, their customer_id should NOT repeat)
  7. Write the SQL code to display the order_id and order_date of all orders that were placed in 2017 (January 1st to December 31st). (Don't forget that date values go inside quotes and have to be in the correct format)
  8. Write the SQL code to display the order_id of all orders that belonged to customer_id 2 and were not shipped. (Please look at the data in the Orders table to figure out how to identify if an order has not shipped yet. Also, watch my video above for a hint)
  9. Write the SQL code to display how many orders were placed in total. (hint: use a certain aggregate function)
  10. Write the SQL code to display how many orders were placed in total FOR EACH customer_id.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Here are the SQL queries for each scenario 1 Display all columns and rowsrecords in the Orders table ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!