david-w3
9/18/2012 - 6:27 AM

MySQL: Check if a column exists in a table

MySQL: Check if a column exists in a table

select column_name
from information_schema.columns 
where table_schema = '__database_name__' 
  and table_name = '__table_name__'
  and column_name = '__column_name__'