[thelist] SQL Query Review

r937 rudy at r937.com
Tue Apr 22 12:13:08 CDT 2008


>> also, an index on entryID would be wise
>
> But entryID is a PK. Would I still want to do that?

no, do not declare indexes for PKs, just for FKs, as well as for any 
non-PK/FK columns used in a WHERE condition


> I have always used array positions. So in the example SQL,
> I would access it in PHP this way:
>
>   $entryTitle=$rs->fields[1];

i don't do php, but i think you're leaving yourself open for disaster if you 
ever change the sequence of the columns in the SELECT clause


>>      FROM entries AS e
>
> ....but that threw me for a loop. What will that do for me?

it will give the alias "e" to the entries table





More information about the thelist mailing list