where column_name = 'realm_id' and table_name = 'dynamic_details' and table_schema = 'rd') then alter table dynamic_details add column `realm_id` int(11) DEFAULT NULL; ...