Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL: where vs. join
Message
De
08/08/2009 11:47:16
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
08/08/2009 11:27:30
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01416873
Message ID:
01416875
Vues:
82
I do prefer JOIN. But do you think that it is possible that using WHERE produces intermediate results of the size of a Cartesian product, even if the end result is correct?

>JOIN is the preferred method for specifying the join condition. WHERE is used to filter the data before it's joined. All the SQL gurus I know use JOIN
>
>>Is it more efficient to use JOIN instead of the older WHERE syntax - specifically for specifying the conditions to join two tables?
>>
>>In some tests I did with code I got from someone else, it took a long time to run, and at some moment, huge intermediate results were produced, to the point where Visual FoxPro complained that the temporary table grew too large. Changing the WHERE to a JOIN seemed to solve this, but so far, I haven't researched enough for the results to be conclusive.
>>
>>It should be noted that in this specific case, the WHERE conditions included join conditions, but also additional conditions, such as not empty(SomeField).
>>
>>If this is as I think it is, using the old-fashioned WHERE syntax could be labelled "plainly wrong", if it is used instead of the join condition. I had been using the JOIN for a while already, but for other reasons: (1) The syntax seems clearer to me (once the programmer gets used to the new syntax!), and (2) Easy to switch between inner and outer join.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform