如何查看mysql 的字段备注
2个回答
2016-11-07
展开全部
,听说过数据库 可以给字段进行备注,如下语句:
`id` int(10) unsigned NOT NULL auto_increment COMMENT '自增id',
这样之后,我要查看备注,语句是什么呢?如下是我在百度找到的一个语句:
SELECT COLUMN_NAME, 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_NAME='表名" . $table . "' AND TABLE_SCHEMA = '数据库名" . $database . "'
`id` int(10) unsigned NOT NULL auto_increment COMMENT '自增id',
这样之后,我要查看备注,语句是什么呢?如下是我在百度找到的一个语句:
SELECT COLUMN_NAME, 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_NAME='表名" . $table . "' AND TABLE_SCHEMA = '数据库名" . $database . "'
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询