Question

Hello, I need help answering all 8 of these questions for my BIS 422 class. I need the appropriate MySQL script to use for these questions

Provide the SQL for the following data requests. Your SQL should be written as a single script that can be pasted into MySQL and run without edits. Make sure you use the proper notation for your comments (see the practice solution for an example of the format). There will be a 5% deduction for scripts that cannot be pasted into MySQL and run without edits.Technician 1 TechnicianID {Certifications) Person Employee OK, EK Employeeld SSN DateOfBirth DateHired [YOS Region Actve YN E

1. List the last names of all the people in the system, and their discount if they are a customer.

2. Provide a list of the total sales (in dollars) by category. Include the category ID, category name, and total sales amount. Sort the list by category ID is ascending order.

3. Provide the average order amount (in dollars) for each state. Sort the results by average amont in descending order.

4. Display the last name and phone number of all of the customers who purchased item 377. Sort the results by last name in ascending order.

5. List the ID, first name, and last name of each salesperson along with their sales goal and their sales to date. Sort the list by last name in ascending order.

6. List the salespeople who have not met their sales goal. Include the ID, first name, and last name of each salesperson along with their sales goal and their sales to date. Sort the list by last name in ascending order.

7. List the first name, last name, and phone number of customers with a 915 area code. Sort the list by first name in ascending order.

8. Provide the average time between when an order is made and when it is shipped

0 0
Add a comment Improve this question Transcribed image text
Answer #1

1.

Select LastName, Discount from Person inner join Customer on Person.PersonID = Customer.CustomerID;

2.

Select CategoryID.CategoryID, CategoryName, '$' + CONVERT(varchar(12), Sum(Price*UnitCost) )as TotalSales from Category inner join SubCategory on Category.CategoryID = SubCategory.CategoryID inner join Item on SubCategory.SubCategoryID = Item.SubCategoryID inner join VendorItem on Item.ItemId = VendorItem.ItemID group by CategoryID.CategoryID, CategoryName order by Category.CategoryID ;

3.

Select State, Avg(OrderPrice) as AverageAmount from Person inner join Customer on Person.PersonID = Customer.CustomerID inner join CustomerOrder on Customer.CustomerID = CustomerOrder.CustomerID inner join CustomerOrderItem on CustomerOrder.CustomerOrderID = CustomerOrderItem. CustomerOrderID group by State order by AverageAmount desc;

4.

Select LastName, PhoneNbr from Person inner join Customer on Person.PersonID = Customer.CustomerID inner join CustomerOrder on Customer.CustomerID = CustomerOrder.CustomerID inner join CustomerOrderItem on CustomerOrder.CustomerOrderID = CustomerOrderItem. CustomerOrderID inner join Item on CustomerOrderItem.ItemId = Item.ItemID where Item.ItemID = 377 order by LastName;

5.

Select SalespersonID, FirstName , LastName , SalesGoal, SalesToDate from Salesperson, Employee,Person where Salesperson.SalespersonID = Employee.EmployeeID and Employee.EmployeeID = Person.PersonID order by LastName ;

6.

Select SalespersonID, FirstName , LastName , SalesGoal, SalesToDate from Salesperson, Employee,Person where Salesperson.SalespersonID = Employee.EmployeeID and Employee.EmployeeID = Person.PersonID and SalesGoal = 'Y' order by LastName ;

7.

Select FirstName, LastName, PhoneNbr, ZipCode from Person , Customer where Person.PersonID = Customer.CustomerID and PhoneNbr LIKE '915%' order by FirstName;

8.

Select Avg(TimeDiff(OrderDate,ShipmentDate)) from Shipment inner join CustomerOrder on Shipment.CustomerOrderID = CustomerOrder.CustomerID;

Do ask if any doubt. Please up-vote.

Add a comment
Know the answer?
Add Answer to:
Hello, I need help answering all 8 of these questions for my BIS 422 class. I...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Create the following SQL Server queries that access the Northwind database Same as problem 3 but,...

    Create the following SQL Server queries that access the Northwind database Same as problem 3 but, limit the list to all customers who placed 3 or more orders. The product id, product name, last date that the product was ordered for all items in the Grains/Cereals category. (Hint: Use MAX) The product ID, product name, and number of distinct customers who ordered that product in 1996 Thank you. Categories Customers Employees Order Details Orders Products Shippers 9 CategoryID CategoryName Description...

  • Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins...

    Question for SQL in MS SQL Server Management Studio (Please don't use where clause for Joins use from clause) Need to Create a Query because Northwind Traders has decided to increase their retail prices. Write a query that shows the product name, the current price, and the new price. Make sure the new price is listed to 2 decimal points. Follow below guidelines on new retail price: a.         If the category is beverages or dairy products, increase the price by...

  • I need help with certain questions. Please. 18. 4 points For each Rental, list the Rental...

    I need help with certain questions. Please. 18. 4 points For each Rental, list the Rental ID, Rental date, customer ID, customer first name, customer last name, and count of disks rented; sort by Rental ID. Show the Rental date formatted as ‘mm-dd-yyyy.’ Hint: use a GROUP BY clause. 19. 4 points List the disk ID, title name, rating, format description, and fee amount for all copies rented in Rental 3; sort by disk ID. Show the fee amount formatted...

  • The Northwind database created by Microsoft contains the sales data for a fictitious company called Northwind...

    The Northwind database created by Microsoft contains the sales data for a fictitious company called Northwind Traders, which imports and exports specialty foods from around the world. Here is the schema of the database: Products (ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued); Suppliers (SupplierID, CompanyName, ContactName , ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax, HomePage); Categories (CategoryID, CategoryName, Description, Picture); Orders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia,  Freight, ShipName,ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry); Order_details (ID, OrderID,...

  • Hi, I'm trying to do my homework for my SQL Server class I keep getting stuck on the questions 1-...

    Hi, I'm trying to do my homework for my SQL Server class I keep getting stuck on the questions 1-5  I found out like how the format need to be I'm just stuck on implanting the code in. Auntie B's Antic ERD CUSTOMER OWNER PEOPLE PeoplelD CustomerSince CHARITY Peopleld FirstName LastName Address City State Zip Phone CellPhone EMail PeopleType CharityID Name Address City State WORKERS PeoplelD HireDate TermDate SSN ip Phone ContactID ORDERS OrderlD OrderDate CustomerlD EmployeelD DONATION DonationID DonationDate...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT