Link to home
Start Free TrialLog in
Avatar of deleyd
deleydFlag for United States of America

asked on

SQL query in one statement or many?

I'm Analyzing / Reverse Engineering some query statements already written. I see it's currently being done in stages, where first there's a SELECT into a table (a permanent table but only used for temporary use as far as I can tell), then there's a second SELECT into another (permanent temporary) table, pulling data from the first table, joining with other tables. Then there's a third SELECT statement, pulling data from the second table joining with other tables. Then there's some filtering out of rows from that third temporary table, and finally the procedure creats the output table we wanted.

Question 1: In theory, is it always possible to fetch any table using just one massive SELECT statement?

Question 2: Would a single massive SELECT statement be any better? Faster? Easier or more difficult to maintain and document?
SOLUTION
Avatar of Kanti Prasad
Kanti Prasad

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial