建议GUI工具查看依赖对象数据库MySQL。
例如:
USE db;
CREATE TABLE t1(
id INT(11) NOT NULL,
`column` INT(11) DEFAULT NULL,
UNIQUE INDEX id (id)
);
CREATE TABLE t2(
id INT(11) NOT NULL,
`column` INT(11) DEFAULT NULL,
INDEX FK_t2_t1_id (`column`),
CONSTRAINT FK_t2_t1_id FOREIGN KEY (`column`)
REFERENCES t1 (id) ON DELETE RESTRICT ON UPDATE RESTRICT
);
CREATE TABLE t3(
id INT(11) NOT NULL,
`column` INT(11) DEFAULT NULL,
INDEX FK_t3_t1_id (`column`),
CONSTRAINT FK_t3_t1_id FOREIGN KEY (`column`)
REFERENCES t1 (id) ON DELETE RESTRICT ON UPDATE RESTRICT
);
DELIMITER $$
CREATE DEFINER = 'root'@'localhost'
PROCEDURE procedure1()
BEGIN
SELECT
*
FROM
db.t1;
END
$$
DELIMITER ;
我想看看哪些对象引用了表t1。 在这个例子中,它是t2,t3和procedure1
答案 0 :(得分:2)
这很有可能是您正在寻找的。信息可以在information_schema中找到。
SELECT pk.constraint_schema AS PKDatabaseName
, pk.table_name AS PKObjectName
, fk_cols.column_name AS PKColumnName
, fk_cols.referenced_table_schema AS FKDatabaseName
, fk_cols.referenced_table_name AS FKObjectName
, fk_cols.referenced_column_name AS FKColumnName
, pk.constraint_name AS ConstraintName
, fk_cols.ordinal_position AS ColumnIdx
FROM information_schema.table_constraints pk
INNER JOIN information_schema.key_column_usage fk_cols
ON pk.constraint_schema = fk_cols.table_schema
AND pk.table_name = fk_cols.table_name
AND pk.constraint_name = fk_cols.constraint_name
WHERE pk.constraint_type = 'FOREIGN KEY'
答案 1 :(得分:1)
您的问题并不是那么清楚,但听起来您正在寻找某种GUI工具来使用MySQL进行数据建模。如果这是正确的,请尝试查看MySQL Workbench。