列出模式中的表
查询一个包含着数据库中所有表名称的系统表
select table_name
from information_scheam.tables
where table_schema = 'SMEAGOL'
列出表的列
列出表的各列,它们的数据类型,以及这些列在表中的位置。
select column_name, data_type, ordinary_position
from information_schema.columns
where table_schema = 'SMEAGOL'
and table_name = 'EMP'
列出表的索引列
列出给定表的索引、索引的列及这些列在索引中的位置(如果可能)。
show index from emp
列出表约束
列出某模式中对某表定义的约束以及这些约束所基于的列。例如,要查找表emp中的约束及约束所基于的列
select a.table_name,
a.constriant_anme,
b.column_name,
a.constraint_type
from information_schema.table_constraints a,
information_schema.key_column_uwsge b
where a.table_name = 'EMP'
and a.table_schema = 'SMEAGOL'
and a.table_name = b.table_name
and a.table-schema = b.table_schema
and a.constraint_name = b.constraint_name
列出没有相应索引的外键
列出含有没有被索引的外键的表。
show index