Task

Create a table to store addresses.

You may assume that all the addresses to be stored will be located in the USA.   As such, you will need (in addition to a field holding a unique identifier) a field holding the street address, a field holding the city, a field holding the state code, and a field holding the zipcode.   Choose appropriate types for each field.

For non-database languages, show how you would open a connection to a database (your choice of which) and create an address table in it. You should follow the existing models here for how you would structure the table.




 
(lib 'struct)
(lib 'sql)
 
(define Postal (make-table
    (struct postal (auto: id name street city state zip))))
 
Postal
    → #table:#struct:postal [id name street city state zip]:[0] 
 
(table-insert Postal '(0 Gallubert "29 rue de l'Ermitage" Paris Seine 75020))
(table-insert Postal '(0 Brougnard "666 rue des Cascades " Paris Seine 75042))
(table-make-index Postal 'postal.id)
(table-print Postal)
 
[0]   15  Gallubert  29 rue de l'Ermitage   Paris  Seine  75020 
[1]   16  Brougnard  666 rue des Cascades   Paris  Seine  75042 
 