Reputation: 123
We can always find a respective table attribute from a table by syntax(select * from table_name), is there way to do the vise versa I mean is there any way to find tables name with attribute name?
Upvotes: 2
Views: 6318
Reputation: 1985
Well, if by tables you mean objects, you can query the data dictionary:
select distinct type_name from dmi_dd_attr_info where attr_name = 'subject'
This will give you the names of all the types which have the attribute "subject"; distinct is needed because you have one entry for each {type, attribute, locale}, so you'll get many lines for the same attribute and type because of the different locales you might have installed.
If by table you mean registered tables, then it depends on whether you registered the tables with the real columns or not. If you did, then you can query the dm_registered objects:
select owner_name, table_name from dm_registered where any column_name = 'dummy'
Upvotes: 7