Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

oracle---知识点考察-----第四天作业

$
0
0

1. 创建表 employee,字段为:
   Id number(4),
   First_Name varchar2(20),
   last_Name varchar2(20),
   mgrid NUMBER(4),
   Job varchar2(20),
   Salary number(7,2)

create table employee(
                    Id number(4),
                    First_Name varchar2(20),
                    last_Name varchar2(20),
                    mgrid NUMBER(4),
                    Job varchar2(20),
                    Salary number(7,2));



2.向表中插入下列数据,并提交,查询数据;
      ID          FIRST_NAME           LAST_NAME MGRID SALARY
      1           Rose                 Tyler      4    1500
      2           Matha                Jones      4    2200
      3           Donna                Noble      4    1300
      4           Doctor               Who             3500
      5           Jack                 Harkness   1    3000

insert into employee values(1,'Rose','Tyler ',4,null,1500);
insert into employee values(2,'Matha','Jones',4,null,2200);
insert into employee values(3,'Donna','Noble',4,null,1300);
insert into employee values(4,'Doctor','Who',null,null,3500);
insert into employee values(5,'Jack','Harkness',1,null,3000);


3. 将 3 号员工的 last_name 修改为“Tate”,并提交,查询数据;

update  employee set last_name='Tate' where id=3;
commit;
select * from employee;


4. 将所有工资少于 5000 的员工的工资修改为 5000 (丌提交),并设置保存点,查询数据;

update employee set salary=5000 where salary<5000;
savepoint a;
select * from employee;


5. 删除 employee 表中所有数据(丌提交),查询数据;
//delete from +表名==delete+表名

delete   employee where 2=2;
select * from employee;


6. 回滚到第四题中的设置的保存点,查询数据;

rollback to a;
select * from employee;


7. 删除表 employee 中所有数据,并提交,查询数据;

truncate table employee;


 

作者:acm365 发表于2013-4-19 9:10:04 原文链接
阅读:0 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>