Select count(*) from multiple tables Select count(*) from multiple tables oracle oracle

Select count(*) from multiple tables


SELECT  (        SELECT COUNT(*)        FROM   tab1        ) AS count1,        (        SELECT COUNT(*)        FROM   tab2        ) AS count2FROM    dual


As additional information, to accomplish same thing in SQL Server, you just need to remove the "FROM dual" part of the query.


Just because it's slightly different:

SELECT 'table_1' AS table_name, COUNT(*) FROM table_1UNIONSELECT 'table_2' AS table_name, COUNT(*) FROM table_2UNIONSELECT 'table_3' AS table_name, COUNT(*) FROM table_3

It gives the answers transposed (one row per table instead of one column), otherwise I don't think it's much different. I think performance-wise they should be equivalent.