Team Fly 

Page 85

Step by Step

In this project, we're going to select some customer and sales information for the customers from Utah. Let's first take a look at our sample SQL query and output before any formatting kicks in:

SQL> select cust_last_name, cust_city, sum(amount_sold)
  2 fromcustomers natural join sales
  3 wherecust_state_province = 'UT'
  4 group by cust_last_name, cust_city;

CUST_LAST_NAME                           CUST_CITY
---------------------------------------- ------------------------------
SUM(AMOUNT_SOLD)
----------------
Bane                                     Farmington
        62605.42
Desai                                    Farmington 
          240.95
Eubank                                   Farmington
        21297.49

CUST_LAST_NAME                           CUST_CITY
---------------------------------------- ------------------------------
SUM(AMOUNT_SOLD)
----------------
Wilbur                                   Farmington
          190.96
Kuehler                                  Farmington
         23258.4
Nielley                                  Farmington
        64509.91

CUST_LAST_NAME                           CUST_CITY
---------------------------------------- ------------------------------
SUM(AMOUNT_SOLD)
----------------
Vankirk                                  Farmington
        19279.94
Campbell                                 Farmington
           11.99
Team Fly 
0104