How to query the database and table based on the column value of a specific field-php Tutorial

Source: Internet
Author: User
How can I query the database and table based on the column value of a specific field? For mysql & gt; 5, & nbsp; if you know that the value of a field column named book_name is eng-chi-dictionary, how can I query the database name and table name of this field? & Nbsp; SQL & nbsp; what is the statement? Thank you. how can I query the database and table based on the column value of a specific field?
For mysql> = 5, if you know that the value of a field column named book_name is eng-chi-dictionary, how can I query the database name and table name of this field? What is the SQL statement?
Thank you.

MySQL SQL

Share To: = 5 ,?? If you know that the value of a field column named book_name is eng-chi-dictionary, how can I query the database name and table name of this field ?? SQL ?... 'Data-pics = ''>


------ Solution --------------------
Eng-chi-dictionary is the field value.
Select * from information_schema.columns where COLUMN_NAME = 'Book _ name ';
------ Solution --------------------
One-time locating statement!
Although we are not that high, we cannot say we are not.
However, professional teams such as phpmyadmin also use php loops to implement the "search" function.
It can be seen that no such statement is true"
See the db_search.php file.
------ Solution --------------------
Select * from information_schema.columns where COLUMN_NAME = 'Book _ name ';
All tables with the book_name field can be obtained.
Where:
TABLE_SCHEMA is the affiliated database
TABLE_NAME is the table name.

You need to traverse the query results and query the tables one by one 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.