MYSQL Get column names concatenated

534 0 0 0

Last Updated : 2024-05-26 18:51:00

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 .