Search code examples
mysqlsqlsql-query-store

write a query that applies to an entire db instead of a table


Is it possible to write a query that applies to an entire database as opposed to one table.

So instead of usin:

 select * from table_name where columnName = ?

Can I say select * db_tables from from db where the table contains the column A?

Is is possible? thanks


Solution

  • You sure can!

    SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME like '%A'