Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How does SQL handle this statement.
Message
 
 
À
29/01/2001 09:59:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00469683
Message ID:
00469692
Vues:
12
>Hi
>
>I have a table - field2 is indexed, field1 isn't. Does it matter which order I put the WHERE clause in when using 2 fields. ie:
>
>SELECT * FROM myTable;
> WHERE field1 = "M";
> AND field2 = "KLAWRENCE"
>
>How will SQL handle this, will it use the indexed field to optimize the SELECT or will it handle the first expression first, then check the 2nd field?
>
>Thanks
>Kev

Kev,
This statement will be partially optimizable because one of the expressions is fully optimable. See chart in Chapter 15: Optimizing Applications.

VFP will get the records adhering to field2 no matter where you which order you put it in because it parses the entire query first to determine what indexes to use. VFP will get all the records matching the field2 crieria then scan through that whole result set to see which match the field1 criteria.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform