Re: sql exist
From: Arjan van Bentem <avbentem_at_DONT-YOU-DAREdds.nl>
Date: Thu, 27 Aug 1998 20:38:18 +0200
Message-ID: <6s490t$p90$1_at_pascal.a2000.nl>
Date: Thu, 27 Aug 1998 20:38:18 +0200
Message-ID: <6s490t$p90$1_at_pascal.a2000.nl>
>Can someone give me an overview of the "exist" function in SQL? Thanks.
Some example might help you. "where exists" yields true if the subselect returns one or more rows. Even if the row is only a null:
select all employees that actually got some money (join would do as well here...)
select emp.name
from employee emp
where exists
( select 'X' -- any real column or dummy here. NULL would do as well!
from salary sal where sal.id = emp.id );
Arjan. Received on Thu Aug 27 1998 - 20:38:18 CEST