Re: Simple SQL?
Date: Sat, 21 Jul 2001 23:25:16 GMT
Message-ID: <3B099024.1CDFB6CA_at_b202.usu.edu>
Your original point was quite valid by itself but this example trivializes the problem. Your A and B tables are not even relational which for many well-trained relational database persons, goes against the notions as proposed by Codd. I teach my students that a whole host of SQL techniques make up an appropriate arsenal including the EXISTS and the correlated subqueries.
For me, advanced (or basic) techniques applied to poor table design don't mean as much and I beat that into my students.
Isaac Blank wrote:
> Try re-writing the SELECT I originally posted using joins.
>
> "JRStern" <JRStern_at_gte.net> wrote in message
> news:3b0969fa.4960843_at_news.gte.net...
> > On Sun, 20 May 2001 15:02:20 -0700, "Isaac Blank" <izblank_at_yahoo.com>
> > wrote:
> > > The keyword is, of course, "multiple", right? Well, if there are
> > >multiple tables or table expressions mentioned in the FROM clause, then
it
> > >is a join. In our case both FROM clauses you underlined only mention one
> > >table each, so they are not joins, but subqueries that happen to be
> > >correlated - because the WHERE clause contains references to the outer
query
> > >context.
> >
> > Piffle. Lots of antique SQL has multitable equates in the FROM
> > clause, even when values are only selected from one table. Your
> > assertion is that these are EXISTS and not JOINS. Well, then, use the
> > EXIST syntax in the query, and I'll grant you style points. However,
> > under the covers, the engine still has to look at two tables, and it's
> > going to be a rare system today that does this simple kind of query
> > much differently, no matter what syntax you use.
> >
> > So, as you speculate, I tend to be lazy and use join syntax rather
> > than Exists, but I'd prefer either to the simple equate in the From.
> >
> > J.
> >
> >
Received on Sun Jul 22 2001 - 01:25:16 CEST
