MySQL conditional insert

Wojtek on conditional, insert, MySQL · · Comments · 1 min read

Sometimes I need to insert some values into the database but only when a certain condition is met. The best example is a newsletter sign up. If someone has already signed up to your newsletter, don’t add his email address again. Of course we can run one query to check if this email address already exists and if not... Read more »