Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用pgadmin在PostgreSQL中查找具有特定列的表名?_Postgresql_Pgadmin - Fatal编程技术网

如何使用pgadmin在PostgreSQL中查找具有特定列的表名?

如何使用pgadmin在PostgreSQL中查找具有特定列的表名?,postgresql,pgadmin,Postgresql,Pgadmin,我使用PGAdmin执行一个查询,如果数据库中有30个表,并且在最小的10到15个表中使用了一列XYZ,那么如何获得使用该特定列的表呢 请帮我解决问题您可以使用信息架构视图: select table_schema, table_name from information_schema.columns where column_name = 'xyz'; 只需右键单击您的模式,然后您将找到一个选项搜索对象。 单击该选项,然后从新打开的窗口中选择要搜索的选项。 现在,将模式填充为

我使用PGAdmin执行一个查询,如果数据库中有30个表,并且在最小的10到15个表中使用了一列XYZ,那么如何获得使用该特定列的表呢


请帮我解决问题

您可以使用信息架构视图:

select table_schema, 
       table_name
from information_schema.columns
where column_name = 'xyz';

只需右键单击您的模式,然后您将找到一个选项搜索对象。 单击该选项,然后从新打开的窗口中选择要搜索的选项。
现在,将模式填充为名称或按照您选择的选项,前缀和后缀为“%”

只需右键单击数据库列表、刷新、架构、公共、表 当我学习pgadmin和postgresql时,我发现这个工具很有用,因为它允许使用ui

将“姓氏”替换为列XYZ

谢谢

只需覆盖所需列的“column_x”:

> select t.table_schema,
>        t.table_name from information_schema.tables t inner join information_schema.columns c on c.table_name = t.table_name 
>                                 and c.table_schema = t.table_schema where c.column_name = 'column_x'
>       and t.table_schema not in ('information_schema', 'pg_catalog')
>       and t.table_type = 'BASE TABLE' order by t.table_schema;

原始来源

它提供输出但没有数据“没有数据”是什么意思。如果语句返回某些内容,那么显然它返回数据。该语句将显示具有这些列名的表。如果不显示任何表名或列名,请返回空白,则您没有具有名为
xyz
的列的表,则我有一个具有列名xyz的表
> select t.table_schema,
>        t.table_name from information_schema.tables t inner join information_schema.columns c on c.table_name = t.table_name 
>                                 and c.table_schema = t.table_schema where c.column_name = 'column_x'
>       and t.table_schema not in ('information_schema', 'pg_catalog')
>       and t.table_type = 'BASE TABLE' order by t.table_schema;