Display the state of customers, the total and the average purchase amounts of each state in 2017 ordered by state.  Rounding the amounts to 2 decimal places.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Display the state of customers, the total and the average purchase amounts of each state in 2017 ordered by state.  Rounding the amounts to 2 decimal places.

The image depicts a database schema diagram, illustrating the relationships between various tables within a database. The schema consists of the following tables:

1. **Department Table**
   - Columns:
     - DEPT_NUM: Decimal(5,0)
     - DEPT_NAME: Varchar(50)
     - DEPT_MAIL_BOX: Varchar(3)
     - DEPT_PHONE: Varchar(9)
     - EMP_NUM: Decimal(6,0)

2. **Employee Table**
   - Columns:
     - EMP_NUM: Decimal(6,0)
     - EMP_FNAME: Varchar(20)
     - EMP_LNAME: Varchar(25)
     - EMP_EMAIL: Varchar(25)
     - EMP_PHONE: Varchar(20)
     - EMP_HIREDATE: Date
     - EMP_TITLE: Varchar(45)
     - EMP_COMM: Decimal(2,2)
     - DEPT_NUM: Decimal(5,0)
   - Relations: Linked to the Department table via DEPT_NUM.

3. **Salary History Table**
   - Columns:
     - EMP_NUM: Decimal(6,0)
     - SAL_FROM_DATE: Date
     - SAL_END_DATE: Date
     - SAL_AMOUNT: Decimal(10,2)

4. **Line Table**
   - Columns:
     - INV_NUM: Decimal(38,0)
     - LINE_NUM: Decimal(10,0)
     - PROD_SKU: Varchar(15)
     - LINE_QTY: Decimal(9,0)
     - LINE_PRICE: Decimal(6,2)
   - Relations: Linked to the Invoice and Product tables.

5. **Invoice Table**
   - Columns:
     - INV_NUM: Decimal(38,0)
     - INV_DATE: Date
     - CUST_CODE: Decimal(38,0)
     - INV_TOTAL: Decimal(11,2)
     - EMPLOYEE_ID: Decimal(6,0)
   - Relations: Linked to Employee and Customer tables.

6. **Customer Table**
   - Columns:
     - CUST_CODE: Decimal(38,0)
     - CUST_FNAME: Varchar(20)
     - CUST_LNAME: Varchar(20)
     - CUST_STREET: Varchar(70)
     - CUST_CITY: Varchar(50)
     - CUST_STATE: Char(2)
     - CUST_ZIP:
Transcribed Image Text:The image depicts a database schema diagram, illustrating the relationships between various tables within a database. The schema consists of the following tables: 1. **Department Table** - Columns: - DEPT_NUM: Decimal(5,0) - DEPT_NAME: Varchar(50) - DEPT_MAIL_BOX: Varchar(3) - DEPT_PHONE: Varchar(9) - EMP_NUM: Decimal(6,0) 2. **Employee Table** - Columns: - EMP_NUM: Decimal(6,0) - EMP_FNAME: Varchar(20) - EMP_LNAME: Varchar(25) - EMP_EMAIL: Varchar(25) - EMP_PHONE: Varchar(20) - EMP_HIREDATE: Date - EMP_TITLE: Varchar(45) - EMP_COMM: Decimal(2,2) - DEPT_NUM: Decimal(5,0) - Relations: Linked to the Department table via DEPT_NUM. 3. **Salary History Table** - Columns: - EMP_NUM: Decimal(6,0) - SAL_FROM_DATE: Date - SAL_END_DATE: Date - SAL_AMOUNT: Decimal(10,2) 4. **Line Table** - Columns: - INV_NUM: Decimal(38,0) - LINE_NUM: Decimal(10,0) - PROD_SKU: Varchar(15) - LINE_QTY: Decimal(9,0) - LINE_PRICE: Decimal(6,2) - Relations: Linked to the Invoice and Product tables. 5. **Invoice Table** - Columns: - INV_NUM: Decimal(38,0) - INV_DATE: Date - CUST_CODE: Decimal(38,0) - INV_TOTAL: Decimal(11,2) - EMPLOYEE_ID: Decimal(6,0) - Relations: Linked to Employee and Customer tables. 6. **Customer Table** - Columns: - CUST_CODE: Decimal(38,0) - CUST_FNAME: Varchar(20) - CUST_LNAME: Varchar(20) - CUST_STREET: Varchar(70) - CUST_CITY: Varchar(50) - CUST_STATE: Char(2) - CUST_ZIP:
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Basic sql queries
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education