MySQL查询表所有列字段SQL

查询所有列字段

SELECT COLUMN_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 't_example';

逗号拼接

SELECT GROUP_CONCAT(COLUMN_NAME)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 't_example';

其他拼接符号

SELECT GROUP_CONCAT(COLUMN_NAME SEPARATOR '-')
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 't_example';