工作中遇到个问题,这个表被其他表引用,产生数据了,这个表的数据就不能删除了,但是由于表太多不知道被哪些表引用了该字段,所以得查出来。
使用以下sql语句:
SELECT * FROM information_schema.columns WHERE table_schema='test' and column_name = 'issues_id';
table_schema:数据库名
column_name:字段名
工作中遇到个问题,这个表被其他表引用,产生数据了,这个表的数据就不能删除了,但是由于表太多不知道被哪些表引用了该字段,所以得查出来。
使用以下sql语句:
SELECT * FROM information_schema.columns WHERE table_schema='test' and column_name = 'issues_id';
table_schema:数据库名
column_name:字段名