oracle中操作数据

时间:2022-10-05 08:59:14

使用特定格式插入日期值

insert into emp
values
(7950,'ZHANGSAN','MANAGER','',
to_date('1988-11-11','yyyy-mm-dd'),
1200.00,50.00,10); insert into emp
values
(7951,'ZHANGSAN','MANAGER','',to_date('1988/11/11','yyyy/mm/dd'),
1200.00,50.00,10);

使用子查询插入数据

create table myemp
(
myId number(4),
myName varchar2(50),
myDept number(5)
); insert into myemp(myId,myname,mydept)
select empno,ename,deptno from emp
where deptno = 10; select * from myemp;

使用子查询更新数据

update emp set (job,sal,comm)
= (select job,sal,comm from emp where ename='SMITH')
where ename = 'SCOTT';