Is there is a way MySQL to get the column names given the value of the column?
For example I have STATES table and CITY table which have 'NAME' as column name.
Say I have 'New York' in both STATES table and CITY table. I want a query which will return the column names of SATES and CITY give 'New York'.
My Expected Output could be like
value column Table
—– —— —–
New York NAME STATES
New York NAME CITY
Above is just an example. In most of the cases i only know the column values and i dont know the Column names or the corresponding table Names. Generally I need not know on the diffrent random schema’s. I am building a question answersing system that will work with multiple databases.
When querying, to help prevent ambiguity, always qualify the fields with alias.column such as