Not the answer you need?
Register and ask your own question!

How to fetch entire table name and entire field name for a particualr data ?

mshuhaib20mshuhaib20 EntrantCurrent User Role Beginner
Hi ,

I have a data ( A012) which is is stored in many tables and in different fields in database .

how to find the field name and the table names for this particular data ?

Thanks .


  • jriverajrivera Percona Support Engineer Percona Staff Role
    Maybe you can query the information_schema.tables database to get the field name and table name.
  • scott.nemesscott.nemes MySQL Sage Current User Role Patron
    Hi mshuhaib20;

    This would be a tough one, since you basically want to check EVERY column in every table in every database for a certain data value. MySQL is not setup to work like that easily.

    I could see two possible solutions:

    1. Write a short bash script to query the information_schema to get a list of all all database/table/column combinations, query each column individually looking for your data value, and then record the database/table/column name if you get a result back. Depending on your database size, this could be a very, very slow process.

    2. Do a mysqldump with the --complete-insert option of all your databases and tables, then parse through the dump file to locate the data value you are looking for. Depending on how good you are with tools like grep/sed/awk/cut/etc., this may be the easier option.

Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.