On Mon, Dec 8, 2008 at 5:50 PM, Chris <[EMAIL PROTECTED]> wrote:

>
>         Sorry, I couldnt find EXIST there, only EXISTS.
>>
>>
>>    If you're going to be that pedantic, "exist" isn't in mysqldump
>>    either :P
>>
>> I know it's pedantic, but unfortunately computers are strictly pedantic
>> and I wasn't sure why you said "if exists" can be used in lots of places
>> other than "drop table",
>> like triggers, functions and i'm sure other things."
>> I was just stating that I saw it in a dump and I never really used it, so
>> assume(d), it's not very important because you can do the same thing with IN
>> etc and other conditions, can't u?
>>
>
> They are completely different things you're mixing up here.
>
> "IF EXISTS" with "DROP TABLE" means "if the table does not exist, do not
> give an error".

I do understand that it's a bit different here.

>
>
> Same for "drop view", "drop trigger". If the view/table/trigger/function
> does not exist, do not give an error.
>
> "EXISTS" in a select query is a subquery - same as using "IN".
>
> Completely different.
>

Right....

So, how are these different:

SELECT * FROM t1 WHERE id EXISTS (SELECT id FROM t2)
to
SELECT * FROM t1 WHERE id IN (SELECT id FROM t2)

??
According to my understanding of the documentation, these would have the
same result. Can't think of any sub query that could not have an equivalent
statement with IN (NOT IN).

>
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>


-- 
Tim-Hinnerk Heuer

http://www.ihostnz.com -- Web Design, Hosting and free Linux Support

Reply via email to