MySQL : Check if field exists

Sometimes, you need to check if a field exists in a table and if it doesn’t, you need to add it to the table and ensure that its there. Below is a snippet which you can use a reference for checking whether a field/column exists in a MySQL database table.

I hope that you find this useful.
The code above should give you a good idea of how to do it.