https://blog.csdn.net/qq_45722267/article/details/126350980?spm=1001.2101.3001.6650.3&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-3-126350980-blog-123066515.235%5Ev31%5Epc_relevant_default_base3&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-3-126350980-blog-123066515.235%5Ev31%5Epc_relevant_default_base3&utm_relevant_index=6
需要使用的的表:INFORMATION_SCHEMA.COLUMNS
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE column_name = '字段名'
INFORMATION_SCHEMA.COLUMNS表中常用字段
字段名 | 描述 |
---|---|
TABLE_SCHEMA | 数据库名 |
TABLE_NAME | 表名 |
COLUMN_NAME | 字段名称 |
COLUMN_COMMENT | 字段注释 |
COLUMN_TYPE | 字段类型(带长度) |
DATA_TYPE | 字段类型 |
SELECT
*
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
column_name = 'hospital_id'
SELECT
*
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
column_name = 'hosp_id'