How to get record count for any query without executing it?
Sometimes you just want to see how many records would some query produce, without actually fetching them all. With Firebird 2 and derived tables it's quite easy:
SELECT COUNT(*) FROM ( your select query );
SELECT COUNT(*) FROM ( select * from employee where emp_no > 8 );
In earlier versions (1.x) of Firebird you should either rewrite the query to get the record count, or create a view and do SELECT COUNT(*) from it. For example:
create view my_employees as select * from employee where emp_no > 8;
SELECT COUNT(*) FROM my_employees;
drop view my_employees;