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