MySQL 命令集合
阿新 • • 發佈:2018-11-20
not null bsp clas null change 命令 tables chang schema
功能1:批量修改Mysql 字段大小寫
SELECT CONCAT(‘ALTER table ‘,t2.table_schema,‘.‘,t2.table_name,‘ CHANGE ‘,‘ \`‘,t2.column_name,‘\` \`‘,UPPER(t2.column_name),‘\` ‘, t2.column_type,‘ ‘,CASE WHEN t2.is_nullable=‘NO‘ THEN ‘not null‘ ELSE ‘null‘ END,‘ COMMENT ‘‘‘,t2.column_comment,‘‘‘;‘) AS c FROM information_schema.tables t1, information_schema.columns t2WHERE t1.table_schema = ‘yourusername‘ AND t1.table_type = ‘base table‘ AND t1.table_schema = t2.table_schema AND t1.table_name = t2.table_name
MySQL 命令集合