How to Insert on Duplicate Key Update with MySQL (an upsert)

This example of a upsert, an on duplicate key insert statement in MySQL. What it does is if the table zipcode_population has a unique index on the column zipcode a typical insert would error if a row the zipcode value of 98275 existed in the table. So you can do what is commonly called an upsert to update if the key is exists, insert otherwise.