当前位置:网站首页>MySQL script batch queries all tables containing specified field types in the database
MySQL script batch queries all tables containing specified field types in the database
2022-07-07 01:15:00 【Chen Li Li】
Due to changes in project requirements , You need to regenerate the code with the table ,text The entity code generated by type reverse engineering will be separated from other types of entities , In order to find out all the contents text Table of fields . Checked and wrote the information , Sort out the query script , Note the . It will inevitably be used again in the future .
List of articles
Query field name and field type
Query all field names and field types in the specified database
SELECT COLUMN_NAME,DATA_TYPE FROM information_schema.COLUMNS WHERE table_schema =' Library name '

Query the table containing the specified field type
mysql The script queries all tables in the database that contain the specified field type
With text Type as an example
Query all the contents in the Library text Type field
SELECT COLUMN_NAME,DATA_TYPE FROM information_schema.COLUMNS WHERE table_schema =' Library name ' AND DATA_TYPE = ' Field type '
Query results :
ver_detail text
ver_url text
menu_desc text
menu_pic text
menu_url text
role_desc text
rule_desc text
rule_txt text
express_name text
mail_body_template text
remark text
send_bean text
msg_site_template text
remark text
remark text
sms_template text
param_desc text
sp_desc text
sql_load text
sp_desc text
oth_params text
url text
para_desc text
para_value text
link_name text

Query all tables with a certain field under the Library
Query all tables with a certain field under the Library
SELECT TABLE_NAME,column_name,data_type,column_type,column_comment FROM information_schema.columns WHERE column_name=' Field ' AND TABLE_SCHEMA=' Library name '
Query results :
t_app_version ver_detail text text

Organize batch scripts
Batch query all tables containing specified field types in the database
SELECT DISTINCT
TABLE_NAME,
column_name,
data_type,
column_type,
column_comment
FROM
information_schema.COLUMNS
WHERE
column_name IN ( SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE table_schema = ' Library name ' AND DATA_TYPE = ' Field type ' )
AND TABLE_SCHEMA = ' Library name '
AND DATA_TYPE = ' Field type '
Return results :
t_auth_menu menu_desc text text ????
t_auth_menu menu_pic text text ??????????????URL?
t_auth_role role_desc text text ????
t_auth_rule rule_desc text text ????
t_auth_rule rule_txt text text ????
t_base_express express_name text text ??????????
t_base_msg_mail mail_body_template text text ??????
t_base_msg_mail remark text text ??
t_base_msg_send_type send_bean text text ???????Bean
t_base_msg_site msg_site_template text text ?????
t_base_msg_site remark text text ??
t_base_msg_sms sms_template text text ????
t_base_msg_sms remark text text ??

边栏推荐
- Dell笔记本周期性闪屏故障
- Batch obtain the latitude coordinates of all administrative regions in China (to the county level)
- Link sharing of STM32 development materials
- 第三方跳转网站 出现 405 Method Not Allowed
- [batch dos-cmd command - summary and summary] - string search, search, and filter commands (find, findstr), and the difference and discrimination between find and findstr
- 第六篇,STM32脉冲宽度调制(PWM)编程
- 新手如何入门学习PostgreSQL?
- Realize incremental data synchronization between MySQL and ES
- Dell Notebook Periodic Flash Screen Fault
- The difference between spin and sleep
猜你喜欢

Batch obtain the latitude coordinates of all administrative regions in China (to the county level)

Data type of pytorch tensor

"Exquisite store manager" youth entrepreneurship incubation camp - the first phase of Shunde market has been successfully completed!

UI控件Telerik UI for WinForms新主题——VS2022启发式主题

「精致店主理人」青年创业孵化营·首期顺德场圆满结束!

Activereportsjs 3.1 Chinese version | | | activereportsjs 3.1 English version

Maidong Internet won the bid of Beijing life insurance to boost customers' brand value

Periodic flash screen failure of Dell notebook

让我们,从头到尾,通透网络I/O模型

pyflink的安装和测试
随机推荐
第五篇,STM32系统定时器和通用定时器编程
【JVM调优实战100例】04——方法区调优实战(上)
随时随地查看远程试验数据与记录——IPEhub2与IPEmotion APP
[batch dos-cmd command - summary and summary] - string search, search, and filter commands (find, findstr), and the difference and discrimination between find and findstr
《安富莱嵌入式周报》第272期:2022.06.27--2022.07.03
Gnet: notes on the use of a lightweight and high-performance go network framework
筑梦数字时代,城链科技战略峰会西安站顺利落幕
Atomic in golang, and cas Operations
Let's see through the network i/o model from beginning to end
腾讯云 WebShell 体验
Oracle:CDB限制PDB资源实战
docker 方法安装mysql
"Exquisite store manager" youth entrepreneurship incubation camp - the first phase of Shunde market has been successfully completed!
UI控件Telerik UI for WinForms新主题——VS2022启发式主题
「笔记」折半搜索(Meet in the Middle)
[hfctf2020]babyupload session parsing engine
[HFCTF2020]BabyUpload session解析引擎
深度学习简史(一)
NEON优化:性能优化常见问题QA
Data type of pytorch tensor