SQL statement comparison
Posted in 1992
Topics: SQL Development & Query Writing, Migration, Import/Export & Data Conversion
I was wondering just how "equivalent" the following two SQL statements
are? E.g. I pretty sure they would produce the same results (I've only
actually used the first one), but I wonder if one is "more right" than the
other, or which one should be "faster". We're using the SE on an HP 9000/835
at version 4.00 (or perhaps higher, but definitely not 5.0).
Thanks.
Statement 1:
unload to "finished.ul" select * from finished
where finished.lot_no in
(select lot_no from lot_info where lot_date <= "093091");
Statement 2:
unload to "finished.ul" select finished.* from finished, lot_info
where finished.lot_no = lot_info.lot_no and
lot_info.lot_date <= "093091";
Since I started out with Informix 3.3 (which did not have all the features
of SQL's select statement), I tend to fall back on things like Statement 2
becaause they "fell more familiar", but I have a feeling that statement 1
is probably the better way to do what I want.
-------------
James B. O'Connor jim@tiamat.fsc.com
Information Technology Manager voice 615/821-4022 x651
Ahlstrom Filtration, Inc. fax 615/821-0616
=========
"Anyone who is capable of getting themselves made President,
should, on no account, be allowed to do the job."
Douglas Adams, _The Restaurant at the End of the Universe_