|
![](/i/fill.gif) |
On 10/27/2009 1:57 PM, Darren New wrote:
> SharkD wrote:
>> It's also the choice of words that are used for some of the commands
>> that irks me. Instead of SELECT I would have used GET. Instead of
>> TRIGGER I would have used EVENT.
>
> That's because you're thinking procedurally instead of declaritively.
>
> You're thinking "The server gets a bunch of rows", instead of "the
> result is the selection of the rows that meet this criteria." You're
> thinking "The server runs this code when it gets an insertion event",
> rather than "this is the code that's triggered by an insertion."
Exactly.
>> Instead of JOIN I would have used INTERSECT.
>
> Join is closer to a union than an intersection. It's actually a
> cartesian product. If you join a 3-row table to a 5-row table, you get a
> 15-row table.
There are three types of joins. In order of popularity they are, 1)
inner, 1) outer, and 3) cartesian. Actually four types, considering that
outer joins can be either left or right.
Inner joins (the most common) are like an intersection -- i.e. only rows
with a positive match in both tables are returned.
Outer joins return either the entire left table or entire right table,
as well as any intersections in the other table.
Cartesian joins are the ones that are like a union. But they're mainly
only used for statistical purposes.
> That said, SQL is indeed one of those languages for which I regularly
> have to look up the syntax even for simple stuff. :-)
Yeah. For me it's a lot easier to remember objects and their methods
than to remember a series of exact phrases verbatim. Compare this with
public speaking, where it is more useful to refer to a basic outline of
a speech than to try and memorize the entire thing word-for-word.
Mike
Post a reply to this message
|
![](/i/fill.gif) |