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

Table Name: CUSTOMERS_1 CUST_NUM CUST_LNAME CUST_FNAME CUST_BAL 2001 James Willi

ID: 3804372 • Letter: T

Question

    Table Name: CUSTOMERS_1

CUST_NUM CUST_LNAME          CUST_FNAME          CUST_BAL

2001    James William           $2,999

2002    Crane Frasier             $983

    Table Name: CUSTOMERS_2

CUST_NUM

            CUST_LNAME          CUST_FNAME          CUST_BAL

1999    Anderson         Anne $510

2000    Bryant Juan     $21

2002    Crane Frasier             $983

2003    Dent    George            $1,790

INSERT INTO CUSTOMERS_2 VALUES (2000, 'Bryant', 'Juan', 21);

    Table Name: CUST_INVOICES

INV_NUM     CUST_NUM INV_DATE    INV_AMOUNT

9000    2000    23-Mar-16       245

9001    2001    23-Mar-16       260

9002    2001    30-Mar-16       275

9003    1000    10-Apr-16       286

From the table above, formulate an SQL query compatable with Microsoft Acces for the following:

    Write a SQL code that will list INV_DATE, the number of invoices issued during each invoice date, and the average invoice amount for each date.

Explanation / Answer

Note : Invoice date and Invoice amount are present in a single table cust_invoices, no other tables are required for this requirement.

Select inv_date, Count(*) , avg(inv_amount) from Cust_Invoices
group by inv_date