Re: Hi! All

From: Michel Cadot <micadot{at}altern{dot}org>
Date: Thu, 29 Jun 2006 18:09:44 +0200
Message-ID: <44a3fb49$0$16240$636a55ce_at_news.free.fr>


"DA Morgan" <damorgan_at_psoug.org> a écrit dans le message de news: 1151595765.559_at_bubbleator.drizzle.com...
| Abha wrote:
| > Can anyone send me SQL Question papers as I am preparing for OCP
| > Examination.
|
| Sure ... here's my favorite.
|
| You have two tables that are absolutely identical in structure. Each
| contains rows of data ... some of which are identical between the
| tables and some of which are not. Find the rows that are distinct and
| in one query return the distinct rows from both tables and the name
| of the table that contained them.
|
| CREATE TABLE t1 (
| col1 VARCHAR2(5));
|
| CREATE TABLE t2 (
| col1 VARCHAR2(5));
|
| INSERT INTO t1 VALUES ('A');
| INSERT INTO t1 VALUES ('B');
| INSERT INTO t1 VALUES ('C');
| INSERT INTO t2 VALUES ('A');
| INSERT INTO t2 VALUES ('C');
| INSERT INTO t2 VALUES ('D');
| COMMIT;
|
| The result from the single query should be:
|
| A T1
| D T2
|
| Enjoy!
| --
| Daniel A. Morgan
| University of Washington
| damorgan_at_x.washington.edu
| (replace x with u to respond)
| Puget Sound Oracle Users Group
| www.psoug.org

I think the result is:

B T1
D T2

Can I compete? ;-)

Regards
Michel Cadot Received on Thu Jun 29 2006 - 18:09:44 CEST

Original text of this message