Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: sql

Re: sql

From: Jens Meihoefer <J.Meihoefer_at_BITS-on-the.net>
Date: 2000/06/15
Message-ID: <8ia6t8$jje$1@news.online.de>#1/1

Andreas Lommel <him_lommel_at_t-online.de> schrieb in im Newsbeitrag: 39489838.95898574_at_news.btx.dtag.de...
> Hi there, maybe someone can help me:
> I have 2 tables
> table1
> name varchar2(10), Smith, Scott, Robinson, Miller
> salary number(5) 1000,1500,1300,1200
> table2
> name varchar2(10), Meyer, Sinclair,
> age (2) 34, 45
> Now I want to create a third table which contains these 2 tables.
> table3
> name varchar(10) Smith, Scott, Robinson, Miller,Meyer, Sinclair,
> age(2) ,,,,34, 45
> salary number(5) 1000,1500,1300,1200,,
>
> How does it work ?

The answer:
insert into table3
(
select name, NULL, salary from table1
UNION
select name, age, NULL from table2
);

Instead of NULL you can use constants like 0 for the age or 1000 for the salary.
hth
Jens (J.Meihoefer@BITS-on-the.net) http://www.BITS-on-the.net Received on Thu Jun 15 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US