Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Questions 1. Write a query to display each zip code and the total owed by custom

ID: 3926656 • Letter: Q

Question

Questions 1. Write a query to display each zip code and the total owed by customers in that zip code. Only include zip codes where the total owed is above 1000.


       SalesRep PK RepID int Customer PK CustomerID int LastName FirstName CommissionRatedecimal(10,2) varchar(20) varchar(20) LastName varchar(20) FirstName varchar(20) Street City State Zipcode Balance varchar(20) varchar(20) char(2) char(5) decimal (10,2) int Order PK OrderID int FK1 RepID FK1 CustomerlD int OrderDate date ShipDate date Part PK PartID int OrderLine Description varchar(20) UnitsOnHandint ItemClass Retail Cost PK,FK1 OrderID int int PK,FK2 PartID char(4) decimal(10,2) decimal(10,2) Quantityint

Explanation / Answer

1)

select zipcode,sum(balance) from Customer where sum(balance)>1000 group by zip code

2)

select PartID,Description from Part where UnitsOnHand>(select avg(UnitsOnHand) from Part)