【问题标题】:How do I search the name of a table, knowing only one of the table's column name in SQL? [duplicate]如何在 SQL 中只知道一个表的列名来搜索表的名称? [复制]
【发布时间】:2015-10-22 19:40:18
【问题描述】:

我正在尝试查找包含我知道名称的列的表。有没有办法只使用列名进行表搜索?

【问题讨论】:

    标签: sql database oracle database-administration


    【解决方案1】:

    在甲骨文中

    select * from user_tab_columns where column_name= '';
    

    【讨论】:

    • 谢谢。我以前从未听说过user_tab_columns,或column_name。我是初学者。我尝试运行这条线,但我不确定为什么 column_name 在其中不起作用:select table_name from all_tables where column_name = ' '; 你能解释一下吗?
    • @Phillip 您使用的是哪个版本的 oracle? select * from all_tables 没有列信息。 All_tables 为您提供表格列表。 User_tab_columns 为您提供数据库中的所有列
    • 试试select * from user_tab_columns where column_name= 'some_column';
    • 我使用的是 Oracle 11g。您刚才给我的命令运行良好,但它并没有达到我希望的效果。当我指定要搜索的列名时, t 只会替换一堆空列名。也许我可以添加一个代码,让它单独显示表格的名称。
    猜你喜欢
    • 2013-04-12
    • 2012-04-26
    • 2014-09-17
    • 2012-06-15
    • 2011-09-06
    • 1970-01-01
    • 2019-09-13
    • 2012-01-06
    • 1970-01-01
    相关资源
    最近更新 更多