Re: Hi! All
From: DA Morgan <damorgan_at_psoug.org>
Date: Thu, 29 Jun 2006 08:42:37 -0700
Message-ID: <1151595765.559_at_bubbleator.drizzle.com>
COMMIT; The result from the single query should be:
Date: Thu, 29 Jun 2006 08:42:37 -0700
Message-ID: <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.orgReceived on Thu Jun 29 2006 - 17:42:37 CEST