如何获取表名和整个数据库中特定列的序数位置 [英] how to get table name and a particular column ordinal position in entire database
本文介绍了如何获取表名和整个数据库中特定列的序数位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个名为 dbSales
的PostgreSQL 9.3数据库,它包含150个表, dbSales
中的大多数表都有名为 product
的列.>
所以我的问题是如何在 dbSales
中获取表名和列乘积序数位置?
解决方案
SELECT表名,列名,顺序位置来自information_schema.columns在哪里table_catalog ='dbSales'和column_name ='product'
信息架构由一组视图组成,这些视图包含有关当前数据库中定义的对象的信息.
I have a PostgreSQL 9.3 database called dbSales
, It contains 150 tables most of the tables in dbSales
have column called product
.
So my question is How can I get table name and the column- product ordinal position in my dbSales
?
解决方案
SELECT table_name,column_name,ordinal_position
FROM information_schema.columns
WHERE table_catalog = 'dbSales' and column_name = 'product'
The information schema consists of a set of views that contain information about the objects defined in the current database.
这篇关于如何获取表名和整个数据库中特定列的序数位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文