[comp.databases] Unify SQL Problem

itkin@mrspoc.Transact.COM (Steven M. List) (02/16/91)

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    :