Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!mrspoc!itkin From: itkin@mrspoc.Transact.COM (Steven M. List) Newsgroups: comp.databases Subject: Re: Unify SQL Problem Message-ID: <1991Feb16.020641.17376@mrspoc.Transact.COM> Date: 16 Feb 91 02:06:41 GMT References: <6973@emory.mathcs.emory.edu> Reply-To: steven@Transact.COM Distribution: usa Organization: Transact Software Lines: 24 cheung@mathcs.emory.edu (Shun Yan Cheung) writes: >Does Unify's SQL has the EXISTS function ? I am getting errors in the >WHERE clause when I try to use the EXISTS clause. If not, what can I >do to reformulate the query ? I suspect using the COUNT() = 0 test might >work, but I have a hard time reformulating it. The query I am looking >into is: Find all employees with no dependents (Query 6 from Elmasri >and Navathe's book on page 187). The relevant relations are: > > EMPLOYEE(SSN, FNAME, LNAME, ....) > DEPENDENT(ESSN, ....) > >where ESSN is a foreign key of the EMPLOYEE relation. Any clues ? select fname, lname, ssn from employee where 0 = select count(*) from dependent where dependent.essn = employee.essn -- +----------------------------------------------------------------------------+ : Steven List @ Transact Software, Inc. :^>~ : : Chairman, Unify User Group of Northern California : : {apple,coherent,limbo,mips,pyramid,ubvax}!itkin@guinan.Transact.COM :