Question: For each question write the question, SQL script and the output. Include all three in a notepad or word document. Do not include screen shots.
For each question write the question, SQL script and the output. Include all three in a notepad or word document. Do not include screen shots. Know how to cut and paste from the SQLplus screen.
customers
| custID | custLName | custFName | DateofBirth | custCity |
|---|---|---|---|---|
| C1 | Attenweiler | Shannon | 10-Jul-1987 | Florence |
| C2 | Marksbury | Faisal | 25-Dec-1965 | Blue Ash |
| C3 | O'Connell | Joseph | 12-Feb-1976 | West Chester |
| C4 | Owen | Meghan | 11-Mar-1982 | Loveland |
| C5 | Sullivan | Sean | 19-Nov-1981 | Batavia |
| C6 | Weaver | John | 21-Jan-1963 | Dayton |
| C7 | Alghanem | Kelli | 22-Apr-1972 | Newport |
| C8 | Ballhaus | William | 6-Oct-1977 | Fort Thomas |
Orders
| orderID | orderDate | Amount | custID |
|---|---|---|---|
| 111 | 11-Mar-2013 | 234.45 | C1 |
| 112 | 11-Mar-2013 | 962.89 | C3 |
| 113 | 12-Mar-2013 | 734.46 | C4 |
| 114 | 13-Mar-2013 | 393.76 | C5 |
| 115 | 13-Mar-2013 | 314.34 | C2 |
| 116 | 13-Mar-2013 | 733.23 | C4 |
| 117 | 16-Mar-2013 | 678.89 | C1 |
| 118 | 16-Mar-2013 | 895.34 | C6 |
| 119 | 16-Mar-2013 | 232.64 | C6 |
| 120 | 16-Mar-2013 | 723.29 | C8 |
| 121 | 17-Mar-2013 | 278.34 | C3 |
| 122 | 17-Mar-2013 | 123.45 | C6 |
| 123 | 17-Mar-2013 | 673.45 | C4 |
| 124 | 18-Mar-2013 | 312.35 | C2 |
| 125 | 19-Mar-2013 | 863.34 | C5 |
| 126 | 19-Mar-2013 | 123.45 | C3 |
| 127 | 19-Mar-2013 | 965.76 | C1 |
Questions:
- List the total number of orders for placed from each city.
- List the total value (amount) for each customer.
- List all the orders (ordered, order date, amount) along with customer details (customer name and city).
- List the customer's name with least total amount of orders.
- List the youngest customer.
- List the number of days past each order.
Step by Step Solution
3.44 Rating (151 Votes )
There are 3 Steps involved in it
Here are SQL queries for each of your questions along with the expected outputs Question 1 List the total number of orders placed from each city sql SELECT ccustCity COUNToorderID AS TotalOrders FROM ... View full answer
Get step-by-step solutions from verified subject matter experts
