1.逗号分隔获取字段名(备注)
SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR ', ') AS field_names
FROM information_schema.COLUMNS
WHERE table_name = 'robot_private'//表名
AND table_schema = 'tg_schedule';//数据库名称
SELECT GROUP_CONCAT(COLUMN_COMMENT SEPARATOR ', ') AS COLUMN_COMMENTS
FROM information_schema.COLUMNS
WHERE table_name = 'robot_private'
AND table_schema = 'tg_schedule';
个人常用sql记录
发布于 2024-10-23 169 次阅读
Comments NOTHING