sql statement to obtain attributes such as column name, data type, and length in a table

Query statement (the database name is customer; the table name is cus_sale)

SELECT
	COLUMN_NAME AS '列名',
	DATA_TYPE AS '字段类型',
	COLUMN_TYPE AS '长度加类型',
	IS_NULLABLE AS '允许空',
	COLUMN_KEY AS '主键',
	COLUMN_COMMENT AS '说明'
FROM
	information_schema.`COLUMNS`
WHERE
	TABLE_SCHEMA LIKE 'customer'
AND TABLE_NAME LIKE 'cus_sale'

search result:

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325064263&siteId=291194637