Can this subquery be reduced to one line?
Date: 6 Oct 1994 22:59:14 GMT
Message-ID: <371vg2$k7j_at_ra.nrl.navy.mil>
I'm learning SQL from Carolyn and Jack Hursch's book Oracle SQL Developer's Guide for version 6.0 (published by Windcrest/McGraw-Hill).
On page 90, there is an example for a subquery that "list all salesman in your Employees Table whose commission is greater than $800." The subquery they give is
SELECT employee_name, title, commission FROM Employees WHERE employee_name IN (SELECT employee_name FROM Employees WHERE commission > 800 AND title = 'salesman'); Couldn't this be simplified as SELECT employee_name, title, commission FROM Employees WHERE commission > 800 AND title = 'salesman';
Are they not equivalent?
I just ran a test case in SQL*plus and I got the same results (tho' in different orders, which is understandable). I've been staring at this all afternoon. Am I missing something?
Are there any comments on the book? Better books? I'm also using C.J. Dates Vol I of An Introduction to Database Systems (Fourth Ed) and the 1st edition of Database Systems Concepts by Korth & Silberschatz to learn SQL concepts.
Thanks in advance!
-- --Ron ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Ron Lee of CCS Operational Networks | Naval Research Lab (Code 5592) Email: lee_at_grizzly.nrl.navy.mil | 4555 Overlook Avenue, S.W. Phone: 202-767-3903 | Washington DC 20375 INTERNET QUOTE: "Thru the gateway, off the repeater, over the T-3 backbone, nothing but 'Net" - Michael G. Reed ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Received on Thu Oct 06 1994 - 23:59:14 CET