Re: Hi! All
From: DA Morgan <damorgan_at_psoug.org>
Date: Tue, 04 Jul 2006 08:42:14 -0700
Message-ID: <1152027738.776684_at_bubbleator.drizzle.com>
>
>
> There are several SQL queries that can achieve the result, 3 as I can think
> of at this moment. What's the point? Exercise?
Date: Tue, 04 Jul 2006 08:42:14 -0700
Message-ID: <1152027738.776684_at_bubbleator.drizzle.com>
Marino Ljubic wrote:
> "DA Morgan" <damorgan_at_psoug.org> wrote in message
> news:1151941370.867909_at_bubbleator.drizzle.com
>> So much for typing rather than cut and paste. Anyone want to post >> their answer?
>
>
> There are several SQL queries that can achieve the result, 3 as I can think
> of at this moment. What's the point? Exercise?
Whatever. Here are the first 3 that popped into my head.
SELECT col1, 'T1'
FROM t1
MINUS
SELECT col1, 'T1'
FROM t2
UNION
SELECT col1, 'T2'
FROM t2
MINUS
SELECT col1, 'T2'
FROM t1;
SELECT col1, 'T1'
FROM t1
WHERE col1 NOT IN (SELECT col1 FROM t2)
UNION
SELECT col1, 'T2'
FROM t2
WHERE col1 NOT IN (SELECT col1 FROM t1);
SELECT col1, 'T1'
FROM t1
WHERE NOT EXISTS (
SELECT col1
FROM t2
WHERE t1.col1 = t2.col1)
UNION
SELECT col1, 'T2'
FROM t2
WHERE NOT EXISTS (
SELECT col1
FROM t1
WHERE t1.col1 = t2.col1);
Your three?
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace x with u to respond) Puget Sound Oracle Users Group www.psoug.orgReceived on Tue Jul 04 2006 - 17:42:14 CEST