When to use Subqueries versus joins?
On what scenario it is better to use JOINS over Sub queries?
Printable View
When to use Subqueries versus joins?
On what scenario it is better to use JOINS over Sub queries?
I always use joins on Thursday's and avoid sub quereies in leap years
Always, except when it doesn't matter.Quote:
Originally posted by ganga
On what scenario it is better to use JOINS over Sub queries?
you need to benchmark all varieties to determine if a join scales better than a subquery (or vice-versa).
An 'IN' clause can work great if you are working against NOT NULL columns within the subquery (like a PK). Sometime an EXISTS clause is better if you know you only need to check for an existence of at least one row.
Joins are more efficient sometimes if you need columns from the joined table.
"No join "/"No Subquery" is still better.
Tamil
I didn't understand your statement there.Quote:
Originally posted by tamilselvan
"No join "/"No Subquery" is still better.
Tamil