MySQLでカラム存在するかどうかを判断
コード:
select count(*) > 1 from
(
SELECT COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
table_name = 'startnews24_test’
AND table_schema = 'startnews24_test’
and COLUMN_NAME = 'ID’
) v