2

我正在使用 SYS.ALL_OBJECTS、SYS.FOREIGN_KEYS 等系统目录视图来获取有关我在 MS SQL 2005 中的数据库结构的信息。

MySQL (v. 5) 服务器是否有等效的功能/视图?

4

2 回答 2

5

对于模式(所有对象);

SELECT * FROM information_schema.SCHEMATA S;

也适用于约束和外键;

SELECT * FROM information_schema.TABLE_CONSTRAINTS T;

对于其他一切,请检查此查询;

SELECT * FROM information_schema.CHARACTER_SETS C;
SELECT * FROM information_schema.COLLATION_CHARACTER_SET_APPLICABILITY C;
SELECT * FROM information_schema.COLLATIONS C;
SELECT * FROM information_schema.COLUMN_PRIVILEGES C;
SELECT * FROM information_schema.`COLUMNS` C;
SELECT * FROM information_schema.KEY_COLUMN_USAGE K;
SELECT * FROM information_schema.PROFILING P;
SELECT * FROM information_schema.ROUTINES R;
SELECT * FROM information_schema.SCHEMA_PRIVILEGES S;  
SELECT * FROM information_schema.STATISTICS S;
SELECT * FROM information_schema.TABLE_PRIVILEGES T;
SELECT * FROM information_schema.`TABLES` T;
SELECT * FROM information_schema.TRIGGERS T;
SELECT * FROM information_schema.USER_PRIVILEGES U;
SELECT * FROM information_schema.VIEWS V;
于 2008-11-12T16:54:18.100 回答
1

嗯,我还没有研究它包含的所有内容,但是 information_schema 中有很多信息。还有show命令。

尽管如此,我还是没有看到一个命令来显示其中的所有外键。

于 2008-11-12T16:38:24.120 回答