I have data value of a table column. I want to know in which database and in which table and in which column the data value appeared in mysql.

7 Years
Discussion Span
Last Post by smantscheff

You'd have to loop through each database, table and column. Are you looking for code to do that ?

Yes, i am looking for that code...


I know you'd have to use SHOW DATABASES, SHOW TABLES and SHOW COLUMNS, but how to use them correctly in a mysql procedure is a little out of my league. Am not sure how to check for the right datatype to match your value. Hopefully someone else will pick this up.

Edited by pritaeas: n/a


I know we can loop through all data base using INFORMATION_SCHEMA.TABLE
But I want better solution with optimum code.

is it possible to use data structure concept to find this.


What means "optimum code" ? In number of code lines? In performance? In usability?
Maybe I would try to solve this not in MySQL but in plain text format on a dump file with regular expressions (grep or, in PHP, preg). This could be the optimum in coding efficiency.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.