I have names of primary keys in a variable and I need to find the table to which they belong. The db has many table so linear search is not an option.
Advertisement
Answer
you can try this out ::
SELECT table_name FROM information_Schema.columns WHERE column_name='dept_id' and ordinal_position = 1;