作者:李永健
撰写时间:2019年 5月16日
开发工具与关键技术:Oracle sql*plus 、 PLSQL Developer
字符和日期型数据应包含在单引号中
Insert:插入
(1) 插入一条数据,指定多少列就给多少值,没指定的列全部默认null值
Insert into jian3(id,name) values(10,’健’);
(2) 没指定出列,给的值一定要对应表中的列数, 例如表有4个列 如下:
Insert into jian3 values(11,’健’,14,20);
(3) 弹出个模态框来插入一条数据
insert into jian1 (id,name)values(’&id’,’&姓名’)
(4)多条数据的插入,从其它表中拷贝数据 这里不必书写values
insert into jian1(select DEPTNO,DNAME from jian3 where DEPTNO = 7)
Update:修改
(1)更新数据,可以一次更新多条数据
Update jian1 set name = ’健’ where id = 1;
(2) 使用子查询
Update employees
Set job_id = (select job_id from employees where employee_id =208 );
salary = (select salary from employees where employee_id =208 );
where employee_id = 114
delete: 删除
delete from jian1 where id = 1;
savepoint: 保留点
insert into jian1(id,name)Values(33,‘健’);
savepoint A;
insert into jian1(id,name)Values(44,‘啦啦’);
savepoint B;
结果图:
Rollback:回滚
执行回滚到A之前的状态
Rollback to A
结果图:
Commit:提交
相当于确认保存,执行提交就不能再回滚了