用于在我的架构中查找包含列的表的 SQL 查询
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8023886/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SQL query for finding tables containing a column in my schema
提问by Bhushan
Can anybody tell me SQL query to return all the tables in my schema which have the column name "IS_REVIEW_APPEALS" ?
任何人都可以告诉我 SQL 查询返回我的架构中具有列名“IS_REVIEW_APPEALS”的所有表吗?
I am using Oracle database.
我正在使用 Oracle 数据库。
Thanks a lot,
非常感谢,
Bhushan
布山
回答by Justin Cave
SELECT table_name
FROM user_tab_cols
WHERE column_name = 'IS_REVIEW_APPEALS'
回答by edicius6
See below query for how to get all columns with the given name for a specific schema in Oracle:
请参阅以下查询,了解如何获取 Oracle 中特定架构的所有具有给定名称的列:
SELECT
t.owner AS schema_name,
t.table_name,
c.column_name
FROM sys.all_tables t
INNER JOIN sys.all_tab_columns c ON t.table_name = c.table_name
WHERE LOWER(t.owner) = LOWER('MySchemaNameHere')
AND LOWER(c.column_name) LIKE LOWER('%MyColumnNameHere%')
ORDER BY t.owner, t.table_name, c.column_name;