MySQL元数据如何生成蜂房表语句注释脚本

MySQL元数据如何生成蜂房表语句注释脚本
前言

本文主要介绍mysql元数据生成的相关内容,蜂房语句语句注释脚本,并与大家分享,供大家参考学习。

最近,当从其他关系数据库(如MySQL到蜂房表)中提取数据时,我们需要同步MySQL表中的注释。下列脚本可以生成蜂房表字段、注释和修改语句。

注意:其他关系数据库,如Oracle,可以通过相同的思想读取元数据,修改脚本语法实现。

使用uff1a

下面的语句是在MySQL数据库执行:information_schema元
选择concat('alter表,table_name,改变柱,column_name,',' column_name ',' data_type ','评论',' ',' column_comment ',';')。
从(选择table_name,column_name案例,当data_type then'string'when = 'varchardata_type = 'int'then'int当data_type then'tinyint'when = 'tinyintdata_type = 'decimal'then'double当data_type then'string'when = 'datetimedata_type = 'timestamp'then'string当data_type then'double'when =浮点的data_type = 'double'then'double当data_type then'bigint'end = 'bigintdata_type,column_comment
从柱
在table_name = 'o_oms_statistic_profit
T);
当从其他关系数据库中提取数据时,比如MySQL和蜂房表,我们需要同步MySQL表中的注释。下面的脚本可以生成蜂房来创建表语句。只生成蜂房表的主要字段信息,还需要手动添加其他信息。

下面的语句是在MySQL数据库执行:information_schema元
选择concat('创建表,table_name,'(',子串(column_info长度(column_info),1,1),' ','评论',' ',table_comment,' ',';')
从(选择table_name,table_comment,group_concat(concat(column_name,',data_type,'评论',',',column_comment,''))为column_info
从(选择时t1.table_name,t2.table_comment然后t1.table_name别的t2.table_comment = null结束table_comment,column_name案例,当data_type then'string'when = 'varchardata_type = 'int'then'int当data_type then'tinyint'when = 'tinyintdata_type = 'decimal'then'double当data_type then'string'when = 'datetimedata_type = 'timestamp'then'string= 'float'then'double '当data_type data_type = 'double'then'double当data_type then'bigint'end = 'bigint时data_type,column_comment空然后column_name别的column_comment =结束column_comment
从列T1 T2 t1.table_name = t2.table_name联接表
在t1.table_name = 'o_oms_statistic_profit
T3)
集团通过table_name,table_comment
T4);
总结

以上就是本文的全部内容。希望本文的内容能给大家的学习或工作带来一定的帮助。如果有任何疑问,您可以留言交流,谢谢您的支持。

tag:注释脚本元数据表语电脑软件

相关内容