Question Detail

How to get column names from MySQL database

5 years ago Views 1390 Visit Post Reply

I'm trying to get the column name from the SQL table.

Thread Reply

alex levine

- 5 years ago

If you want to get Column Name from your SQL Query you have to use table schema or information_schema

SELECT column_name FROM information_schema.columns WHERE table_schema = 'YOUR_DATABASE_NAME' AND table_name = 'YOUR_TABLE_NAME'


Above query will bring all your Column Names Array in the Result.