Skip to content

Instantly share code, notes, and snippets.

@jamespsterling
Created June 18, 2014 16:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamespsterling/b3ed21ce4f843422e566 to your computer and use it in GitHub Desktop.
Save jamespsterling/b3ed21ce4f843422e566 to your computer and use it in GitHub Desktop.
Fast way to get all column headers in a comma-separated list
select GROUP_CONCAT(CONCAT("'",COLUMN_NAME,"'"))
from INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'my_table'
AND TABLE_SCHEMA = 'my_schema'
order BY ORDINAL_POSITION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment