Mysql query the database table design and export Excel

 In the information_schema COLUMNS mysql database table, a record of all the field information table structure of database.

COLUMNS table can query to query this column COLUMN_NAME attribute information table structure, such as field names, field types, data type, default values, and other comments.

Navicat for example to visualize query and export Excel:
1. New Query, and enter a SQL query

#查询SQL
select 
	column_name '字段名称', 
	column_type '字段类型', 
	data_type '数据类型',
	CHARACTER_MAXIMUM_LENGTH '长度', #只能查询二进制/字符长度
	if(is_nullable = 'yes','能','否') '能否为空',
	column_comment '注释'
from information_schema.`COLUMNS`
where 
	table_schema = 'bank1' #表所在数据库
and 
	table_name = 'account_info'  #表名

2. Run SQL queries and export Excel

Click Export in the pop-up box, select Excel format, and then click Next Select export path, and then press has finally beginning to export click Next.

Published 18 original articles · won praise 0 · Views 549

Guess you like

Origin blog.csdn.net/weixin_41645232/article/details/104308762