Question: Write a query to display the customer code, customer last name, and the number of invoices generated by that customer. Limit the results to only

Write a query to display the customer code, customer last name, and the number of invoices generated by that customer. Limit the results to only customers who have at least five invoices. Sort the results by customer code. The column labels and first few rows of your output must match the figure below.

LGCUSTOMER LGBRAND PK Cust Code PK Brand ID Cust Fname Cust Lname Cust Street Brand Name Brand Type Cust City Cust State Cust ZIP Cust Balance inclldes places LGPRODUCT LGLINE PK Prod SKU LGINVOICE PK,FK1 Iny Num PK Prod Descript Prod Type Prod Base Prod Category Prod Price Prod QOH Line Num PK Inv Num appears on contains FK1 Cust Code Inv Date Inv_Total FK2 Employee ID FK2 Prod SKU Line_Qty Line Price Prod Min FK1 Brand ID completes provided by LGEMPLOYEE PK Emp Num LGSALARY HISTORY LGSUPPLIES Emp_Fname Emp Lname Emp Email Emp Phone Emp Hiredate Emp Title Emp Comm FK1 Dept Num PK,FK1 Emp Num PK PK,FK1 Vend ID PK,FK2 Prod SKU has Sal From Sal End Sal Amount provides manhges employs LGVENDOR PK Vend ID LGDEPARTMENT Vend Name Vend Street Vend City Vend State Vend_ZIP PK Dept Num Dept Name Dept Mail Box Dept Phone FK1 Emp Num CUST_CODE CUST_LNAME Number of Invoices 86 HUDSON 88 10 VIGIL 89 CANTRELL GOLDMAN 90 6 92 GONZALEZ 93 BASSETT 95 DUNLAP 6 96 TRUJILLO 10 97 ANDERSON 98 MARINO 14 99 VENTURA LGCUSTOMER LGBRAND PK Cust Code PK Brand ID Cust Fname Cust Lname Cust Street Brand Name Brand Type Cust City Cust State Cust ZIP Cust Balance inclldes places LGPRODUCT LGLINE PK Prod SKU LGINVOICE PK,FK1 Iny Num PK Prod Descript Prod Type Prod Base Prod Category Prod Price Prod QOH Line Num PK Inv Num appears on contains FK1 Cust Code Inv Date Inv_Total FK2 Employee ID FK2 Prod SKU Line_Qty Line Price Prod Min FK1 Brand ID completes provided by LGEMPLOYEE PK Emp Num LGSALARY HISTORY LGSUPPLIES Emp_Fname Emp Lname Emp Email Emp Phone Emp Hiredate Emp Title Emp Comm FK1 Dept Num PK,FK1 Emp Num PK PK,FK1 Vend ID PK,FK2 Prod SKU has Sal From Sal End Sal Amount provides manhges employs LGVENDOR PK Vend ID LGDEPARTMENT Vend Name Vend Street Vend City Vend State Vend_ZIP PK Dept Num Dept Name Dept Mail Box Dept Phone FK1 Emp Num CUST_CODE CUST_LNAME Number of Invoices 86 HUDSON 88 10 VIGIL 89 CANTRELL GOLDMAN 90 6 92 GONZALEZ 93 BASSETT 95 DUNLAP 6 96 TRUJILLO 10 97 ANDERSON 98 MARINO 14 99 VENTURA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
