The following is my beginning flat file:
| InvoiceNumber | FirstName | Last Name | Address | Phone Number | DL | Type | Color | Year | Warranty? | Type of Sale | DateSold | Salesperson |
| 0 | Suzanne | Richards | 736 Steland Avenue, Davis, Ca 83647 | 510-374-9976 | S6532439 | Automatic | Green | 1999 | TRUE | Cash | 13-Oct-00 | 1 |
| 1 | Ferrin | Rusty | 728 Highland Avenue, Sacramento, CA 37583 | 916-374-7589 | G2639576 | Standard | Red | 1999 | TRUE | Credit | 16-Oct-00 | 2 |
| 2 | Gennifer | James | 6237 Oakland Avenue, Helfied, CA 72635 | 716-374-5484 | F3263784 | Automatic | Dark Red | 2000 | FALSE | Cash | 16-Oct-00 | 2 |
| 3 | Spartacus | Vargas | 73 Hillsdale Way, Woodland, CA 95973 | 530-748-4725 | H8363784 | Automatic | White | 2000 | TRUE | Credit | 15-Oct-00 | 1 |
| 4 | Herrald | Hanis | 81 World Terrace, Peidmont, CA 94611 | 510-263-3847 | J73648957 | Standard | Teal | 2001 | TRUE | Cash | 16-Oct-00 | 3 |
After normailizing it to the second form, I get:
Customer
| Customer I | FirstName | LastName | Address | Phone Number | DL |
| 1 | Suzanne | Richards | 736 Stelan | 510-374-9976 | S6532439 |
| 2 | Ferrin | Rusty | 728 Highla | 916-374-7589 | G2639576 |
| 3 | Gennifer | James | 6237 Oakl | 716-374-5484 | F3263784 |
| 4 | Spartacus | Vargas | 73 Hillsdal | 530-748-4725 | H8363784 |
| 5 | Herrald | Hanis | 81 World | 510-263-3847 | J73648957 |
And my Flat File is now:
| InvoiceNumber | Type | Color | Year | Warranty? | Type of S | DateSold |
| 0 | Automatic | Green | 1999 | TRUE | Cash | 10/13/2000 |
| 1 | Standard | Red | 1999 | TRUE | Credit | 10/16/2000 |
| 2 | Automatic | Dark Red | 2000 | FALSE | Cash | 10/16/2000 |
| 3 | Automatic | White | 2000 | TRUE | Credit | 10/15/2000 |
| 4 | Standard | Teal | 2001 | TRUE | Cash | 10/16/2000 |
But we aren't done because hopefully your Salespeople will reoccur plenty of times in the Sales table.
| Salesperson | |
| 1 | Griffin |
| 2 | Jundy |
| 2 | Jundy |
| 1 | Griffin |
| 3 | Harris |
Which becomes:
| Salesperson | |
| 1 | Griffin |
| 2 | Jundy |
| 3 | Harris |
So now you have:
Sales:
| InvoiceNumber | Type | Color | Year | Warranty? | Type of S | DateSold | Customer# |
| 0 | Automatic | Green | 1999 | TRUE | Cash | 10/13/2000 | 1 |
| 1 | Standard | Red | 1999 | TRUE | Credit | 10/16/2000 | 2 |
| 2 | Automatic | Dark Red | 2000 | FALSE | Cash | 10/16/2000 | 3 |
| 3 | Automatic | White | 2000 | TRUE | Credit | 10/15/2000 | 4 |
| 4 | Standard | Teal | 2001 | TRUE | Cash | 10/16/2000 | 5 |
Customers:
| Customer I | FirstName | LastName | Address | Phone Number | DL |
| 1 | Suzanne | Richards | 736 Stelan | 510-374-9976 | S6532439 |
| 2 | Ferrin | Rusty | 728 Highla | 916-374-7589 | G2639576 |
| 3 | Gennifer | James | 6237 Oakl | 716-374-5484 | F3263784 |
| 4 | Spartacus | Vargas | 73 Hillsdal | 530-748-4725 | H8363784 |
| 5 | Herrald | Hanis | 81 World | 510-263-3847 | J73648957 |
Salespeople:
| Salesperson | |
| 1 | Griffin |
| 2 | Jundy |
| 3 | Harris |
Assignment:
Select * from Sales
InvoiceNumber Type Color Year Warranty? Type of Sale DateSold Salesperson
Select Type from Sales
type
Automatic
Standard
Automatic
Automatic
Standard
Select Type, Year from Sales
type year
Automatic 1999
Standard 1999
Automatic 2000
Automatic 2000
Standard 2001
Select * from Sales Where Year = 2000
InvoiceNumber Type Color Year Warranty? Type of Sale DateSold
Salesperson
2 Automatic Dark Red 2000 No Cash 10/16/2000 Jundy
3 Automatic White 2000 Yes Credit 10/15/2000 Griffin