MySql查询表名,字段名

MySql在众多表中查找一个表名或者字段名的SQL语句:

SELECT table_name, column_name FROM information_schema.columns WHERE column_name = 'Name';

下面两种方法也可以查到:

SELECT column_name FROM information_schema.columns WHERE column_name LIKE ’%searchTerm%’ AND table_schema = ‘yourDB’;
SELECT column_name FROM information_schema.columns WHERE column_name LIKE ’%searchTerm%’ AND table_schema = ‘yourDB’ AND table_name = ‘yourDBTable’;

发表评论

电子邮件地址不会被公开。 必填项已用*标注