search column by name mysql 1

search column by name mysql

select table_name, column_name 
from information_schema.columns 
where column_name like '%search_keyword%'; -- change search_keyword accordingly

Here is what the above code is Doing:
1. We are using the information_schema.columns table to get the table_name and column_name of all the columns that have the word search_keyword in them.
2. We are using the LIKE operator to search for the word search_keyword in the column_name column.
3. We are using the % wildcard to match any string of any length (including zero length) before and after the word search_keyword.

Similar Posts