logo       

RE: Fun with SQL: msg#00067

programming.language-of-the-year

Subject: RE: Fun with SQL

It's interesting that you assumed the simplest database design for the
problem. I assumed something more complex, given that he struggled to
create the query.

The query gets much more difficult when the Students table does not keep
summary data about tardies. What we don't know is whether his database
is keeping a record of days that were attended or days that were tardy.
A record of days that were attended makes the query much more fun -
finding the holes among known school days instead of having a list of
them. Also adding to the difficulty (although not much) is whether you
have a field on the Students table that identifies the date of the last
tardy message, or whether you have a table that keeps track of the tardy
messages and have to check it for the last date sent per student.

-----Original Message-----
From: Frohnhofer, James [mailto:james.frohnhofer-eZjFLiI6sRM@xxxxxxxxxxxxxxxx]
Sent: Wednesday, June 23, 2004 9:44 AM
To: 'pragprog-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx'
Subject: RE: [pragprog] Fun with SQL


SELECT NAME FROM STUDENTS WHERE DAYS_TARDY > 3 AND DAYS_TARDY >
LAST_TARDY_MSG_SENT

<send messages>

UPDATE STUDENTS SET LAST_TARDY_MSG_SENT = DAYS_TARDY WHERE DAYS_TARDY >
3 AND
DAYS_TARDY > LAST_TARDY_MSG_SENT


Am I missing something? That took me about 20 seconds. (I can't touch
type.)
And the query couldn't be more easily understood.

Of course, I realize that that proves nothing. I just assumed I had a
database designed with my query in mind. I realize that depending on
the
table structure you might end up w/ something pretty convoluted. But my
point
was that it isn't the syntax that's getting in the way, it's failure to
understand the metaphor of the language.

(Of course the success of MS Access vs. pure SQL undermines this point
almost
completely -- so please no one bring it up.)

-----Original Message-----
From: Chris Morris [mailto:chrismo-jPI29ImzmbLYtjvyW6yDsg@xxxxxxxxxxxxxxxx]
Sent: Wednesday, June 23, 2004 12:47 AM
To: pragprog-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx
Subject: Re: [pragprog] Fun with SQL


Ron Jeffries wrote:

>On Tuesday, June 22, 2004, at 3:55:33 PM, Frohnhofer, James wrote:
>
>
>
>> B) its primary metaphor of rows, tables and keys is
consistent,
pervasive
>>and easily grasped.
>>
>>
>
>On what planet is it true that SQL has been successful with real end
users?
>I don't think I've /ever/ encountered real end users who weren't
getting
>their SQL done by DB specialists.
>
>
And sometimes not easily grasped by DB specialists.

Show me the SQL for this: "I need to see all students who have had three

or more tardies, and send the student a report of those tardies. Then I
need to make sure I don't resend a tardy report to the same student,
unless they've accrued additional tardies."

Granted, it's a long couple of sentences, but I think the concept is
pretty straightforward in humanville. Getting the right SQL statement
(vs. one that /seems/ right but really isn't) can be tricky (or at least

it was to a dunderhead like me :-)

--
Chris
http://clabs.org/blogki





Yahoo! Groups Links






========================================================================
======
This message is for the sole use of the intended recipient. If you
received
this message in error please delete it and notify us. If this message
was
misdirected, CSFB does not waive any confidentiality or privilege. CSFB
retains and monitors electronic communications sent through its network.
Instructions transmitted over this system are not binding on CSFB until
they
are confirmed by us. Message transmission is not guaranteed to be
secure.
========================================================================
======





Yahoo! Groups Links








------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->


Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/pragprog/

<*> To unsubscribe from this group, send an email to:
pragprog-unsubscribe-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/





<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise