Last active
August 29, 2015 14:01
-
-
Save nasirkhan/9ff1848a215d61880463 to your computer and use it in GitHub Desktop.
Get all the column names of a MySQL database table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* MY_DATABASE_NAME will be replaced by the name of your database | |
* MY_TABLE_NAME will be repaced by the name of your database table | |
*/ | |
SELECT | |
`COLUMN_NAME` | |
FROM | |
`INFORMATION_SCHEMA`.`COLUMNS` | |
WHERE | |
`TABLE_SCHEMA` = 'MY_DATABASE_NAME' | |
AND `TABLE_NAME` = 'MY_TABLE_NAME'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment