本文介紹了在 MySQL 數據庫的每個表的字段中搜索文本的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想在 MySQL 數據庫的所有表的所有字段中搜索給定字符串,可能使用以下語法:
I want to search in all fields from all tables of a MySQL database a given string, possibly using syntax as:
SELECT * FROM * WHERE * LIKE '%stuff%'
有沒有可能做這樣的事情?
Is it possible to do something like this?
推薦答案
您可以查看 information_schema
架構.它具有所有表和表中所有字段的列表.然后,您可以使用從該表中獲得的信息運行查詢.
You can peek into the information_schema
schema. It has a list of all tables and all fields that are in a table. You can then run queries using the information that you have gotten from this table.
涉及的表是SCHEMATA、TABLES和COLUMNS.有外鍵,您可以準確地構建在模式中創建表的方式.
The tables involved are SCHEMATA, TABLES and COLUMNS. There are foreign keys such that you can build up exactly how the tables are created in a schema.
這篇關于在 MySQL 數據庫的每個表的字段中搜索文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!