Sql 如何区分数据库对象(在Oracle中)是表还是视图

Sql 如何区分数据库对象(在Oracle中)是表还是视图,sql,oracle,Sql,Oracle,我想区分视图和表。基本上,我想找到所有具有特定列名的表 select table_name from user_tab_columns x where column_name='STUDENTID'; 上面的查询还返回具有相同列的视图。我试着使用下面的,但是,我觉得运行和返回需要很长时间 select table_name from user_tables where table_name in (select x.table_name from user_tab_columns x wher

我想区分视图和表。基本上,我想找到所有具有特定列名的表

select table_name from user_tab_columns x where column_name='STUDENTID';
上面的查询还返回具有相同列的视图。我试着使用下面的,但是,我觉得运行和返回需要很长时间

select table_name from user_tables where table_name in (select x.table_name from user_tab_columns x where x.column_name='PLAN_NAME');

请给我任何建议。

我想加入比再选择要快。试试这个:

select c.table_name 
from user_tab_columns c, user_tables t
where c.table_name = t.table_name
and c.column_name='STUDENTID';

“长时间”返回的时间可能重复多久?我有点怀疑你有这么多的列和表,这需要一秒钟多的时间。当第一次在我的数据库上运行查询时,需要2秒才能返回。令人惊讶的是,如果我运行它,它需要0.06秒+1,当然,我们可以使用用户视图以同样的方式过滤表。