CREATE TABLE YH ( id int PRIMARY KEY COMMENT '主键id', name varchar(50) NOT NULL COMMENT '姓名', age int COMMENT '年龄' ) COMMENT '用户表';创建表
SELECT TABLE_COMMENT AS '表注释', TABLE_ROWS AS '表中的行数(估计值)', CREATE_TIME AS '表创建时间', UPDATE_TIME AS '表最后修改时间' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'YH';查询表信息
SELECT ORDINAL_POSITION AS '序号', COLUMN_NAME AS '列名', DATA_TYPE AS '类型', COLUMN_TYPE AS '详细类型', CASE COLUMN_KEY WHEN 'PRI' THEN '主键' WHEN 'UNI' THEN '唯一索引' WHEN 'MUL' THEN '非唯一索引' ELSE COLUMN_KEY END AS '索引', IS_NULLABLE AS '是否为 NULL', COLUMN_COMMENT AS '注释' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 'YH';查询表字段信息
标签:COMMENT,YH,COLUMN,WHEN,Mysql,TABLE,SCHEMA From: https://www.cnblogs.com/zj19940610/p/17312547.html