MySQL query to get column names?

The best way is to use the INFORMATION_SCHEMA metadata virtual database. Specifically the INFORMATION_SCHEMA.COLUMNS table…

SELECT `COLUMN_NAME`
FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`=’yourdatabasename’
AND `TABLE_NAME`=’yourtablename’;

http://stackoverflow.com/questions/4165195/mysql-query-to-get-column-names

  • Facebook
  • TwitThis
  • StumbleUpon
  • Digg
  • del.icio.us

,