Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Written in SQL /* 22. List the total amount of sales for all orders.*/ /* 23. For each order detail, list the orderid, productid, and

image text in transcribedWritten in SQL

/* 22. List the total amount of sales for all orders.*/

/* 23. For each order detail, list the orderid, productid, and the total sale price (include the discount). HINT: If my quantity was 10, each one cost $20 and had a discount of 10%, my formula may appear as (10*(20*(1 -.10)) result would be 180. */

/* 24. List the total amount of sales for all orders. (with discounts included). Result: 1265793.03974152 */

/* 25. How old is each employee? List the oldest at the top of the list. HINT: Can use DateDiff(interval, date1, date2) function: DATEDIFF(dd, Birthdate, SYSDATETIME())/365 AS Age */

/* 26. Create a list of suppliers (companyname, contactname) and the products (product name) they supply. Sort the list by supplier, then product (77 Records) */

/* 27. Create a list of customers (companyname) and some information about each order (orderid, orderdate, shipdate) they have placed. (830 Records) */

/* 28. Create list of products that were shipped to customers on 04/18/2012. (4 Records) */

/* 29. Create a list of customers that have ordered Tofu. Make sure to list each customer only once. (18 Records) */

/* 31. Create a mailing list to send information to all the customers, employees, and suppliers. Sort the list by city. (129 records) */

/* 32. Create a view called NumCustomerOrders which lists all the customers and the number of orders they have placed. Be sure to list the customer even if they have not placed an order. (91 records) */

Suppliers * SupplierID Company Name Contact Name ContactTitle Address City Region PostalCode Country Phone Fax HomePage Products ProductID ProductName SupplierID CategoryID QuantityPerUnit Unit Price UnitsInStock Units OnOrder ReorderLevel Discontinued Order Details OrderID * ProductID UnitPrice Quantity Discount Orders OrderID CustomerID EmployeeID OrderDate RequiredDate ShippedDate Ship Via Freight Ship Name ShipAddress Ship City Ship Region ShipPostalCode Ship Country Customers * CustomerID CompanyName ContactName ContactTitle Address City Region PostalCode Country Phone Fax Categories CategoryID CategoryName Description Picture Shippers * ShipperID CompanyName Phone Employees EmployeeID LastName FirstName Title TitleOfCourtesy BirthDate HireDate Address City Region PostalCode Country Home Phone Extension Photo Notes ReportsTo

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions