MySQL表结构查询

12/31/2023 后端数据库MySQL

目录


# 一、Mysql表结构查询

SELECT
	column_name 								AS '名',
	column_comment 								AS '备注(中文名)',
	column_default 								AS '默认值',
--	column_type 								AS '类型',
	data_type 									AS '类型',
	character_maximum_length                    AS '长度',
--	numeric_precision                    		AS '精度',
	numeric_scale 							  	AS '小数位数',
	IF ( is_nullable = 'NO', 'N', '' )        	AS '能否为空',
	IF ( extra = 'auto_increment', 'Y', '' ) 	AS '是否自增',
	IF ( column_key = 'PRI', 'Y', '' )        	AS '是否主键'
FROM
	information_schema.columns 
WHERE
	table_schema = '' 
	AND table_name = ''
--  导出到桌面的Excel表格	
--  INTO OUTFILE 'D:/test.xls'
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
上次更新时间: 11/13/2024, 8:26:38 AM