# index.sql was originally generated by the autoSql program, which also 
# generated index.c and index.h.  This creates the database representation of
# an object which can be loaded and saved from RAM in a fairly 
# automatic way.

#A simple address book
CREATE TABLE addressBook (
    id int unsigned auto_increment,	# Auto increment primary key
    name varchar(255) not null,	# Name - first or last or both, we don't care
    address varchar(255) not null,	# Street address
    city varchar(255) not null,	# City
    zipCode int unsigned not null,	# A zip code is always positive, so can be unsigned
    state char(2) not null,	# Just store the abbreviation for the state
              #Indices
    PRIMARY KEY(id),
    UNIQUE(name),
    INDEX(city(12)),
    INDEX(zipCode),
    INDEX(state)
);

#example of enum and set symbolic columns
CREATE TABLE symbolCols (
    id int auto_increment,	# unique id
    sex enum("male", "female") not null,	# enumerated column
    skills set("cProg", "javaProg", "pythonProg", "awkProg") not null,	# set column
              #Indices
    PRIMARY KEY(id),
    INDEX(sex)
);
