POV-Ray : Newsgroups : povray.off-topic : Question for SQLers out there : Re: Question for SQLers out there Server Time
11 Oct 2024 03:16:45 EDT (-0400)
  Re: Question for SQLers out there  
From: Gail Shaw
Date: 12 Feb 2008 16:11:20
Message: <47b20b78@news.povray.org>
"Tom Austin" <taustin> wrote in message news:47b204ce$1@news.povray.org...

>
> So, using JOIN is more explicit - it requires a condition for the JOIN
> where just using a where clause does not?

Yup

This is valid
SELECT tbl1.Col1, tbl2.col2 from tbl1, tbl2 WHERE tbl1.Col1 = tbl2.Col1

This is also value, but will likely kill your server if the 2 tables have a
reasonably large number of rows
SELECT tbl1.Col1, tbl2.col2 from tbl1, tbl2

This is valid (and equivalent to the first)

SELECT tbl1.Col1, tbl2.col2 from tbl1 INNER JOIN tbl2 ON  tbl1.Col1 =
tbl2.Col1

This is not valid and will throw an error (on MS SQL 2005, a rather
misleading one)
SELECT tbl1.Col1, tbl2.col2 from tbl1 INNER JOIN tbl2

It's clear and easy to see on 2 tables. On more, can get messy. Especially
if there are joins on multiple columns, it's quite easy to have a table that
looks like it's joined, but isn't. See below mess.

Select T1.Col1, T2.Col1, T3.Col2 T4.Col3, T4.Col3 FROM Table1 T1, Table2 T2,
Table3 T3, Table4 T4, Table4 T5
WHERE T1.Col1 = T2.Col1 AND T2.Col2 = T3.Col2 AND T1.Col7 = 'abc' AND
T2.Col1 = T3.Col1 AND T4.Col3 = T5.Col3 AND T4.Col2>5


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.