Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search a column name from a MySQL database? [duplicate]

Tags:

sql

mysql

I am running a huge database with so many tables and tables are having so many columns.

My DB is MySQL and I have to search for a particular column.

Is there a way available in MySQL to search a column name from all tables in a database?

like image 291
Joomler Avatar asked Mar 18 '16 09:03

Joomler


1 Answers

Retrieve it from INFORMATION_SCHEMA COLUMNS Table

Query

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

Or if you want to search for exact column name then no need of LIKE.

where column_name = 'column_name_to_be_find';
like image 110
Ullas Avatar answered Oct 21 '22 01:10

Ullas