当前位置:网站首页>MySQL queries the attributes of all fields in the database
MySQL queries the attributes of all fields in the database
2022-04-22 07:59:00 【Rufeng Z】
In large projects, there are hundreds of tables in the database , Want the same field name in the statistics database , Different lengths or types , All field properties . Use simple SQL Help us make statistics .
1. Query the properties of all fields in a database ( Specify database name ), If you want to query all where The conditions are good
select * from information_schema.columns
where table_schema= ' Database database name '
2. Query the attributes of all fields in the specified table in the database ( Specify database name and table name )
select * from information_schema.columns
where table_schema= ' Database database name ' and table_name = ' Table name '
3. Query the attribute whose specific column condition is a field name in the database
select table_schema,table_name,column_name,column_type,column_comment
from information_schema.columns
where TABLE_SCHEMA=' Database name ' and column_name = ' Field name ';
4. Query specific columns in the database ( Such as : Field name 、 Field type , Length size 、 Field comments, etc )
select table_schema,table_name,column_name,column_type,column_comment from information_schema.columns
where table_schema= ' Database database name '
- table_schema: Database database name
- table_name: Table name
- column_name: Field name
- column_type: Field properties ( Contains the field type and length )
- column_comment : Annotation fields ( Field description )
- data_type: Field type
- column_key: The primary key of the field (PRI Primary key )
- is_nullable: Is the field empty
If there is any mistake, please correct it ~~
Learning record
=======
Query a table in the database that does not contain a field
SELECT
table_name,
column_name
FROM
information_schema.COLUMNS
WHERE
table_schema = 'database'
AND table_name NOT IN ( SELECT table_name FROM information_schema.COLUMNS WHERE table_schema = 'database' AND column_name = ' Field name ' GROUP BY table_name )
版权声明
本文为[Rufeng Z]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220623588183.html
边栏推荐
- 继续树莓派4B+OLED:开机自动显示IP地址
- 树莓派:访问Bitlocker To Go加密过的磁盘
- Oopc [i] C language objectification
- 观察者模式--ApplicationContext
- [C - attribute]
- 【从零开始写漏扫】主机发现——手写一个子域名挖掘器
- Reconnaissance des chiffres manuscrits MNIST basée sur le modèle lenet - 5 du réseau neuronal convolutif
- Easylogging++日志库
- SSRF 与 XXE 攻击原理及利用
- Autoware显示用户界面细节
猜你喜欢

继续树莓派4B+OLED:开机自动显示IP地址

Unity mask click the lower UI game to start guiding Click
![[TCP / IP overview]](/img/51/509865a5350cd77dc639c9f2fb4f1c.png)
[TCP / IP overview]

XSS靶场过关

C # made a simple raspberry pie IP search tool

Easylogging + + log Library
![RT thread [III] link Detailed explanation of LDS link script](/img/80/d62360d0a281b89dcfff61cb2f21ce.png)
RT thread [III] link Detailed explanation of LDS link script

SSRF 与 XXE 攻击原理及利用

Raspberry Pie: 4.2-inch ink screen

图解《工业互联网专项工作组2022年工作计划》
随机推荐
记录一次爬虫的总结
Circular explanation and various small details
Ultra vires and business logic vulnerabilities
Raspberry pie 4B: USB mobile hard disk box startup (beta version)
Autoware显示用户界面细节
C-10 age issues
An alternative method of sending fixed format Chinese short message in Arduino: taking dht22 + GSM module as an example
Conversion et fonction du format commun MFC
Binary conversion -- learning summary
Read iso15031 protocol data stream
【建站笔记】:在wordpress博客文章中插入代码段并高亮显示
T-SQL: an interview question in Hospital Information Department
树莓派4B:使用raspi-config实现USB BOOT
Oopc [i] C language objectification
STM32 peripherals [i]
ArrayList 和 LinkedList 的区别比较
Use of method C
PLC项目调试七步法
读取WWH-OBD(ISO27145协议)数据流
Visual Studio编译器使用总结