首页  

MySQL获取所有表和表结构信息     所属分类 mysql 浏览量 793
information_schema.COLUMNS
TABLE_SCHEMA
TABLE_NAME
COLUMN_NAME

information_schema.TABLES

select  TABLE_NAME,TABLE_COMMENT from information_schema.TABLES 
where TABLE_SCHEMA='dbname' and TABLE_NAME like 'xxx%' 


SELECT
column_name AS '列名',
data_type AS '数据类型',
character_maximum_length AS '字符长度',
numeric_precision AS '数字长度',
numeric_scale AS '小数位数',
is_nullable AS '是否允许非空',
CASE WHEN extra = 'auto_increment'
THEN 1 ELSE 0 END AS '是否自增',
column_default AS '默认值',
column_comment AS '备注'

from information_schema.COLUMNS

where TABLE_SCHEMA='dbname' and TABLE_NAME = 'tablename'



SELECT column_name AS '字段名', data_type AS '数据类型', ifnull(character_maximum_length,'') AS '长度',
is_nullable AS '是否允许非空',column_comment AS '说明'
from information_schema.COLUMNS
where TABLE_SCHEMA='cmcf_alert' and TABLE_NAME = 'tssc_email_server_info' order by ORDINAL_POSITION


 order by ORDINAL_POSITION   字段按建表语句顺序

上一篇     下一篇
log4j2使用要点

JNDI demo

logback简介

BI常用词汇

akka简介

数据仓库入门