Question: SQL -Thank you 1. Write a SELECT statement that returns two columns from the order details table. Orderid and orderamount, where orderamount is the sum

SQL -Thank you 1. Write a SELECT statement that returns two columnsSQL

-Thank you

1. Write a SELECT statement that returns two columns from the order details table. Orderid and orderamount, where orderamount is the sum of quantity * unitprice. Group by orderID.

2. Write a SELECT that returns two columns, orderid and the sum of unitprice * quantity, display as invoiceanount. Join orders to order details where the orderid is the same in each table. Group by orderid returning the top 10 orderids.

3. Write a SELECT statement that returns three columns. Customerid, ordercount and invoiceamount. Ordercount is the count of the number of orders. Invoiceamount is the sum of the unitprice * Quantity. Join orders to order details. Group the result set by customerid with the largest number of orders appearing first.

4. Write a SELECT statement that will return three columns. ProductName, productcount and invoiceamount. Join the order details table to the products table when the productid is not equal to orderid. Group by productname. That has a count greater than zero. Order by productcount.

5. Modify the solution to exercise #4 to filer for invoices dated from January 1, 1996 to December 31, 1996. HINT: Join to the Orders table to code a search condition based on InvoiceDate.

Categories CategoryID CategoryName Description Picture Order Details 9 Order 9 ProductID UnitPrice Quantity Discount - CustomerCustomer Demo Customer 8 CustomerTypeID Customers 8 Customer ID Company Name Contact Name Contact Title Orders y Order Customer - Employees 7 Employeeld LastName Address First Name Title TitleOfCourtesy BirthDate City Region Postal Code Country Phone CustomerDemographics ? CustomerTypelo CustomerDesc Employeeld OrderDate RequiredDate Shipped Date Ship Via Freight Ship Name ShipAddress Ship City Ship Region Ship Postal Code Ship Country Products ProductD Suppliers 8 Supplier Company Name Contact Name Contact Title HireDate Fax Address City kos Region Postal Code Product Name Supplier CategoryID QuantityPerunit UnitPrice Unitsin Stock Units OnOrder ReorderLevel Discontinued Address City Region Postal Code Country Phone Country Homcf hon Extension Photo Note: Fax HomePage Shippers 8 ShipperID Company Name Phone Reports To Photo Path

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!