Suppose we have a table user and we want to fetch all its column name.
For this we use INFORMATION_SCHEMA.
we will use following query to fetch all column name of table
1 2 3 4 | SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`='social' AND `TABLE_NAME`='user'; |
Above query will fetch all columns of user table available in social database.