丄丄丄丄丄好像第四个的语法是 :create table if not EXISTS newtalbe like oldtalbe;丄丄丄丄丄丄丄丄丄
转载:http://www.2cto.com/database/201309/247412.html
判断表是否存在
SELECT count( * ) FROM information_schema.TABLES WHERE table_name = 'table name' AND TABLE_SCHEMA = 'database name'
判断列是否存在
select count(*) from information_schema.columns where table_schema='库名' and table_name='表名' and column_name='列名'