现在的位置: 首页 > 综合 > 正文

SQLCookbook 学习笔记 5元数据查询

2018年05月03日 ⁄ 综合 ⁄ 共 373字 ⁄ 字号 评论关闭

元数据是关于数据的数据



列出所有的 表

select table_name from information_schema.tables ;


列出所有的列。

select * from information_schema.columns 


列出表的索引

show index from emp;


列出表约束

select a.table_name, b.constraint_name, b.column_name,a.constraint_type from  information_schema.table_constraints a, information_schema.key_column_usage b where a.table_name =‘emp' and b.table_name = a.table_name;

约束是关系数据库的关键部分,要知道在表中有什么样的约束是理所当然的要求。

索引





抱歉!评论已关闭.