使用Oracle8i查询

发布于 2024-10-01 00:52:54 字数 1018 浏览 7 评论 0原文

如何使用Oracle8I将table1中的数据输出到table2中? 我使用的是Aqua Data Studio 7.5,后端是Oracl8i。

表 1:

Name              Prods Cus_id
Mark              Rice  87311870
Judy              Rice  87364239
Judy              Bowl  87364239
Tom               Apple 87404026
Tom               Milk  87404026
Tom               Coffee    87404026
Smith             Peanut    87500245
Smith             Tea   87500245
Ortiz             Egg   87569724
Ortiz             Cheese    87569724
Ortiz             Pizza 87569724
Ortiz             Pepper    87569724
Hunt              Chips 87570092

表 2:

Name        Prod1       Prod2       Prod3       Prod4   Cus_id
Mark        Rice                            87311870
Judy        Rice        Bowl                    87364239
Tom Apple   Milk        Coffee          87404026
Smith       Peanut      Tea                 87500245
Ortiz       Egg     Cheese      Pizza       Pepper  87569724
Hunt        Chips                           87570092

How do I output the data from table1 into table2 using Oracle8I?
I am using Aqua Data Studio 7.5 and the backend is Oracl8i.

Table1:

Name              Prods Cus_id
Mark              Rice  87311870
Judy              Rice  87364239
Judy              Bowl  87364239
Tom               Apple 87404026
Tom               Milk  87404026
Tom               Coffee    87404026
Smith             Peanut    87500245
Smith             Tea   87500245
Ortiz             Egg   87569724
Ortiz             Cheese    87569724
Ortiz             Pizza 87569724
Ortiz             Pepper    87569724
Hunt              Chips 87570092

Table2:

Name        Prod1       Prod2       Prod3       Prod4   Cus_id
Mark        Rice                            87311870
Judy        Rice        Bowl                    87364239
Tom Apple   Milk        Coffee          87404026
Smith       Peanut      Tea                 87500245
Ortiz       Egg     Cheese      Pizza       Pepper  87569724
Hunt        Chips                           87570092

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一曲琵琶半遮面シ 2024-10-08 00:52:54

请参阅此示例:

set feedback off;
set pagesize 0;

create table foo (a number, b varchar(10), c varchar(10));

insert into foo values ( 15, 'abc','def' );
insert into foo values (998, 'max','min' );
insert into foo values (  7, 'bla','bla' );
insert into foo values (632, 'now','then');

insert into foo 
  (a,b,c)
  (select                   AA,
                            BB,
                            CC 
  from
    (select max(a) +1       AA      from foo), 
    (select 'new'           BB,
            'old'           CC      from dual));

select * from foo where a = (select max(a) from foo);

drop table foo;

来源:Oracle SQL:使用 Select 插入

See this example:

set feedback off;
set pagesize 0;

create table foo (a number, b varchar(10), c varchar(10));

insert into foo values ( 15, 'abc','def' );
insert into foo values (998, 'max','min' );
insert into foo values (  7, 'bla','bla' );
insert into foo values (632, 'now','then');

insert into foo 
  (a,b,c)
  (select                   AA,
                            BB,
                            CC 
  from
    (select max(a) +1       AA      from foo), 
    (select 'new'           BB,
            'old'           CC      from dual));

select * from foo where a = (select max(a) from foo);

drop table foo;

Source: Oracle SQL: Insert with Select

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文