[thelist] "A Brief Rhapsody on Art and Engineering"

Rudy_Limeback at maritimelife.ca Rudy_Limeback at maritimelife.ca
Fri Sep 8 12:52:55 CDT 2000


>> http://www.microship.com/index.html 
>
> Thanks for sending this; absolutely wonderful


yes, thanks steve

and yes, there's some really good content

but this microship guy is a total fruitcake, i've seen tv and magazine 
articles about his bike trips

so is pirsig, the author of zen and the art of motorcycle maintenance, 
which i liked so much (who didn't?) that i read the followup lila, a total 
disappointment

and of course, i mean "total fruitcake" in a fond and friendly way

i have nothing but admiration for people living on the edge of sanity (or, 
as in pirsig's case, on the other side of it), for they are blessed with 
true creativity, and often an unrelenting drive to get things done...


<tip type="sql" 
     synopsis="GROUP BY and ORDER BY are not the same">

ORDER BY returns results in the requested order --

     /* list categorys by name */
       select category
         from categorys
     order by category

ORDER BY returns detail rows, i.e. one row for each row in the results 
table

GROUP BY, on the other hand, returns summary rows --

     /* count articles by category */
       select category,count(*)
         from categorys, content
        where categorys.categoryid = content.categoryid 
     group by category

GROUP BY returns one row for each *group* in the results table

usually GROUP BY without ORDER BY will (as expected) return results in 
GROUP BY order, but this is not actually guaranteed

if you *have* to have results in GROUP BY order, include the ORDER BY --

     /* list categorys with article count */
       select category,count(*)
         from categorys, content
        where categorys.categoryid = content.categoryid 
     group by category
     order by category

of course, you can also have a different sequence --

     /* list categorys by most articles */
       select category,count(*)
         from categorys, content
        where categorys.categoryid = content.categoryid 
     group by category
     order by 2 desc

</tip>


two for the price of one --


<tip type="sql"
     comment="very important for web-database response time">
take a long, hard look at database calls inside a loop, and find a way to 
eliminate the loop -- table joins can solve most of these situations
</tip> 


rudy
r937.com




More information about the thelist mailing list