当前位置:网站首页>MySQL gets fields and comments by indicating

MySQL gets fields and comments by indicating

2022-06-24 21:59:00 Vransy.

SELECT
	column_name,
	( CASE WHEN ( is_nullable = 'no' && column_key != 'PRI' ) THEN '1' ELSE NULL END ) AS is_required,
	( CASE WHEN column_key = 'PRI' THEN '1' ELSE '0' END ) AS is_pk,
	ordinal_position AS sort,
	column_comment,
	( CASE WHEN extra = 'auto_increment' THEN '1' ELSE '0' END ) AS is_increment,
	column_type 
FROM
	information_schema.COLUMNS 
WHERE
	table_schema = (
	SELECT DATABASE
	()) 
	AND table_name = ( ' Your watch name ' ) 
ORDER BY
	ordinal_position;
原网站

版权声明
本文为[Vransy.]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/175/202206241523215583.html