Table column names comma delimited list [ 675 views ]
Goal: quick method to get the column names comma delimited list
Simple mysql or mariadb database. How to get a detailed select command if I don’t have a good sql gui tool. So, here is an easy way:
select GROUP_CONCAT(COLUMN_NAME) from INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'INFORMATION_SCHEMA' AND TABLE_NAME = 'files';
where TABLE_SCHEMA is your schema, and TABLE_NAME is the table in the question.
The result will be like…
FILE_ID,FILE_NAME,FILE_TYPE,TABLESPACE_NAME,...