MySql gets table fields and table field comments

MySql gets table fields and table field comments

demand

  • Sometimes we need to query form fields for the front-end selection field to pass information

mysql5.7 writing

SELECT
	column_name `column`,
	column_comment columnName 
FROM
	information_schema.COLUMNS 
WHERE
	table_name = '表名' 
-- 	SELECT DATABASE ( ) 获取当前使用表名的数据库名称
	AND table_schema = ( SELECT DATABASE ( ) );

Guess you like

Origin blog.csdn.net/rao991207823/article/details/108478739