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

408 views Asked by At

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

2

There are 2 answers

1
zambonee On BEST ANSWER

You sure can!

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

You cannot do SELECT * FROM all the tables, but you can run a query aganist multiple tables using other statements in SQL.