On Sun, Mar 22, 2015 at 5:02 PM, Igor Tandetnik <igor at tandetnik.org> wrote:

> On 3/22/2015 6:52 PM, Scott Robison wrote:
>
>> Thinking back to when I was first learning SQL, I remember being surprised
>> in a similar way. To my procedural / object oriented / imperative way of
>> thinking, the subselect was like a function
>>
>
> Even with this way of looking it at it - wouldn't it be strange to have
> functions but no mechanism for them to take parameters? A field from an
> outer query is to a correlated subquery what a parameter is to a function
> in a traditional imperative language.


Yes. :) It's just something not though through completely. At the outermost
level, if you say "select something from somewhere" then the something is
coming from somewhere. If you say "select (select something from
somewhereelse) from somewhere" (horrible example but you get the gist), but
"something" is a typo and does not exist in "somewhereelse", it is not
immediately obvious that it can pick up "something" from "somewhere" since
it is outside the parentheses.

A whole bunch of years later, I get it. At the time it wasn't intuitive to
me.

-- 
Scott Robison

Reply via email to