MYSQL Get column names concatenated

474 0 0 0

Last Updated : 2024-03-28 22:26:06

If you want to get a table column names from mysql database as a concatenated string, you can use the following code

SELECT group_concat(COLUMN_NAME)
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'chamberstream' AND TABLE_NAME = 'phases';

//------------------------------------------------------
SHOW COLUMNS FROM phases

Mohammed Anwar

Mohammed Anwar

Experienced technical lead PHP, MySQL and Laravel Developer for 15+ years, with proven ability to develop and create high-quality and optimized web applications. Great ability to build and optimize database design, schema and queries. Versed programing trainer and instructor delivering web courses and helping others to get into the field in a timely manner. Fast and eager learner for new technologies .