How do I query the libraries and tables that are located based on the values of a particular field column?

Source: Internet
Author: User
MySQL SQL

For mysql>=5, if you know the value of a field column named Book_name is eng-chi-dictionary, how can I query the name of the library and table where this field is located? What is the SQL statement?
Thank you


Reply to discussion (solution)

SELECT * from Information_schema.columns where column_name= ' eng-chi-dictionary ';

COLUMN_NAME should be book_name.
Book_name value is eng-chi-dictionary, I now know there is a book_name called eng-chi-dictionary, how to find schema_name table_name

Eng-chi-dictionary is the field value.
SELECT * from Information_schema.columns where column_name= ' book_name ';

SELECT * from Information_schema.columns where column_name= ' book_name ';


This is true, but it is not possible to position one at a time, because when the library and table are relatively long, there may be many columns in the table with column_name as Book_name


Now is the time to find a single-position statement.

Single-position Statement!
Although we are not so high level, can not say there must be no
But a professional team like phpMyAdmin is also using PHP loops to implement the "search" function.
No such statement is "true".
See db_search.php file

Do not understand your ' one-time positioning ' refers to what?

Because when libraries and tables are relatively large, there may be many columns in the table that have column_name as Book_name
Note that the returned column does not have a library name and a table name. Is that not clear enough?

I mean just find out which eng-chi-dictionary is the value of the book_name below the table in which library.

SELECT * from Information_schema.columns where column_name= ' book_name ';

This should be to find out all the columns named Book_name. But I'm still not sure where eng-chi-dictionary is.

SELECT * from Information_schema.columns where column_name= ' book_name ';
All tables with field book_name can be obtained.
which
Table_schema as a subordinate library
TABLE_NAME for Table name

You need to iterate through the results of the query, looking up the table to see if Book_name contains Eng-chi-dictionary

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.