【个人笔记 hive】mysql获取表元数据信息主键、主键类型等

mysql获取表元数据信息主键、主键类型等:
可根据表名直接获取相关我们所需的信息:比如如下

SELECT k.TABLE_NAME,k.COLUMN_NAME
FROM 
  information_schema.table_constraints t
JOIN 
  information_schema.key_column_usage k
USING 
    (constraint_name,table_schema,table_name)
WHERE 
    t.constraint_type='PRIMARY KEY'
AND 
    t.table_schema='crm'	# 数据库名字
AND 
  t.table_name='t_customer' # 表名

具体可以根据以上自己需求更改
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/m0_49303490/article/details/128125995