SQL Database Of US States

We recently had to create a table of US States for use with our e-commerce software, Ballyhoo Commerce. We'd like to share our findings in the hope that they will benefit someone else.

/* Create DB table */
CREATE TABLE states (
   iso CHAR(2) NOT NULL ,
   name VARCHAR(20) NOT NULL
) ENGINE = MYISAM COMMENT = 'Table of US States';

/* Insert records */
insert into states (iso,name) values ('AL','Alabama');
insert into states (iso,name) values ('AK','Alaska');
insert into states (iso,name) values ('AZ','Arizona');
insert into states (iso,name) values ('AR','Arkansas');
insert into states (iso,name) values ('CA','California');
insert into states (iso,name) values ('CO','Colorado');
insert into states (iso,name) values ('CT','Connecticut');
insert into states (iso,name) values ('DE','Delaware');
insert into states (iso,name) values ('FL','Florida');
insert into states (iso,name) values ('GA','Georgia');
insert into states (iso,name) values ('HI','Hawaii');
insert into states (iso,name) values ('ID','Idaho');
insert into states (iso,name) values ('IL','Illinois');
insert into states (iso,name) values ('IN','Indiana');
insert into states (iso,name) values ('IA','Iowa');
insert into states (iso,name) values ('KS','Kansas');
insert into states (iso,name) values ('KY','Kentucky');
insert into states (iso,name) values ('LA','Louisiana');
insert into states (iso,name) values ('ME','Maine');
insert into states (iso,name) values ('MD','Maryland');
insert into states (iso,name) values ('MA','Massachusetts');
insert into states (iso,name) values ('MI','Michigan');
insert into states (iso,name) values ('MN','Minnesota');
insert into states (iso,name) values ('MS','Mississippi');
insert into states (iso,name) values ('MO','Missouri');
insert into states (iso,name) values ('MT','Montana');
insert into states (iso,name) values ('NE','Nebraska');
insert into states (iso,name) values ('NV','Nevada');
insert into states (iso,name) values ('NH','New Hampshire');
insert into states (iso,name) values ('NJ','New Jersey');
insert into states (iso,name) values ('NM','New Mexico');
insert into states (iso,name) values ('NY','New York');
insert into states (iso,name) values ('NC','North Carolina');
insert into states (iso,name) values ('ND','North Dakota');
insert into states (iso,name) values ('OH','Ohio');
insert into states (iso,name) values ('OK','Oklahoma');
insert into states (iso,name) values ('OR','Oregon');
insert into states (iso,name) values ('PA','Pennsylvania');
insert into states (iso,name) values ('RI','Rhode Island');
insert into states (iso,name) values ('SC','South Carolina');
insert into states (iso,name) values ('SD','South Dakota');
insert into states (iso,name) values ('TN','Tennessee');
insert into states (iso,name) values ('TX','Texas');
insert into states (iso,name) values ('UT','Utah');
insert into states (iso,name) values ('VT','Vermont');
insert into states (iso,name) values ('VA','Virginia');
insert into states (iso,name) values ('WA','Washington');
insert into states (iso,name) values ('WV','West Virginia');
insert into states (iso,name) values ('WI','Wisconsin');
insert into states (iso,name) values ('WY','Wyoming');
Anthony Chaffey

By Anthony Chaffey

Anthony is Ballyhoo's Managing Director and Web Developer, responsible for building your website and keeping it online.