数据库
首页 > 数据库> > mysql 表转 java 实体 sql

mysql 表转 java 实体 sql

作者:互联网

SELECT
    concat(
        'private ',
        v.dataType,
        '  ',
        v.column_name,
        ';//',
        v.column_comment
    )
FROM
    (
        SELECT
            CASE
        WHEN (
            data_type = 'varchar'
            OR data_type = 'char'
            OR data_type = 'text'
            OR data_type = 'blob'
        ) THEN
            'String'
        WHEN data_type = 'int' THEN
            'int'
        WHEN data_type = 'double' THEN
            'double'
        END AS dataType,
        column_name,
        column_comment
    FROM
        information_schema. COLUMNS
    WHERE
        table_name = 'store'
    ) v

 

标签:comment,java,name,column,data,WHEN,表转,sql,type
来源: https://www.cnblogs.com/luweiweicode/p/14761877.html