一、获取表描述
select table_name,table_comment from information_schema.TABLES where table_schema = '%s' and table_name in (%s)
二、获取视图DDL
SELECT * FROM information_schema.views WHERE TABLE_NAME = '%s' and TABLE_SCHEMA = '%s'
三、判断表是否存在sql
select table_name from information_schema.TABLES where table_name = '%s' and table_schema = '%s'
四、字段详情查询
select table_name,column_name,ordinal_position,column_default,EXTRA,is_nullable,data_type,column_comment,column_key,numeric_precision,numeric_scale,character_maximum_length from information_schema.columns where table_name in ('%s') and table_schema = '%s'
五、查询当前用户是否存在
select host,user form mysql.user where user = '%s'
六、查询库列表
SELECT schema_name SCHEMA_NAME FROM information_schema.schemata
七、查询表列表
select table_name,table_comment from information_schema.TABLES where table_schema = '%s' and table_type = '%s'
八、查询用户对某表所拥有的权限
select Table_priv from `mysql`.`tables_priv` where Host in ('%', '%s') and DB = '%s' and User='%s' and Table_name = '%s'
九、查询分区信息
select * from information_schema.PARTITIONS where table_name in (%s) and table_schema = '%s' ORDER BY TABLE_NAME ASC,PARTITION_ORDINAL_POSITION ASC
文章来源地址https://www.toymoban.com/news/detail-798461.html
文章来源:https://www.toymoban.com/news/detail-798461.html
到了这里,关于TIDB: 元数据查询语句的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!