把拆分成下图 一开始我的想法是创建个备份表,然后备份表update成50%,原表update成50%,再把备份表的数据复制到原表里
解决方案 »
- 函数怎么调用
- 在oracle中定义了包,也定义了主体,但在调用函数的时候有错
- 想学Oracle,有没有好的网站啊?
- 求一条sql语句
- 刚接触Oracle数据库求一个Sql查询语句
- [提问]Java开发人员如何转型数据库
- 如何在存储过程中执行 imp/exp等命令?
- 奇怪奇怪真奇怪,高手进来看一看!!
- 请问一SQL问题。
- ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exit是进入LQLPLUS的错误提示,请问这是什么错误,急!急
- orcle导入dmp数据报错!重新把自己的本地数据库改为zhs16gbk字符集重新导入依然会报错!
- java连接oracle数据库报错ntly know of service requested in connect descriptor
SELECT 1,'a',2000 FROM dual
UNION ALL SELECT 2,'b',3000 FROM dual
UNION ALL SELECT 3,'c',2500 FROM dual;
--SELECT * FROM test_t;
INSERT INTO test_t t1 SELECT * FROM test_t t2;
COMMIT;
UPDATE test_t SET sal=0.5*sal ;
COMMIT;
(SELECT 1 fd1, 'a' fd2, 2000 fd3
FROM dual
UNION ALL
SELECT 2 fd1, 'b' fd2, 3000 fd3
FROM dual
UNION ALL
SELECT 3 fd1, 'c' fd2, 2500 fd3
FROM dual),
tb2 as
(select 2 fd1 from dual union all select 2 fd1 from dual)
select a.fd1, a.fd2, a.fd3 / b.fd1 from tb1 a, tb2 b
create table test_A
(
ID varchar(20) ,
name varchar(20),
sal int
);
--2.插入测试数据
insert into test_A values('1','a',2000);
insert into test_A values('2','b',3000);
insert into test_A values('3','c',2500);
--3.按百分比加工,并在name字段拼一个test
insert into test_A (select 'test'||ID ,name,sal*0.5 from test_A union all select 'test'||ID ,name,sal*0.5 from test_A)
--4.删除原来的数据
select * from test_A t where instr(t.name,'test')=0
--5.将name后面的test去掉
update test_A t set name=substr(t.name,5,length(t.name));