1、define命令可以用于定义哪种变量
a、number
b、char
c、varchar2
d、date
【b】
Host变量主要作用是起到一个替代变量的作用,是主机环境可以和oracle进行交互的一个媒介。 通过define定义host变量的时候必须指定变量名和变量的值,如果变量名已经存在于host变量中,则自动覆盖,这个值不可以指定类型,一律按char存储。
2、sql plus命令可以访问数据库吗
a、可以
b、不可以
【a】
3、建立sql脚本disp.emp.sql,要求完成:
1)显示部门号、雇员号、雇员名,并按部门号进行排序
2)页头为“雇员报表”
3)每个部门只显示一次部门号
4)设置行宽为60个字符
5)设置页的总计显示行数为40行
6)显示雇员工资时,要带有本地货币符号
7)在select语句后清除所有选项设置
如图所示:
- TTI “雇员报表”;
- set linesize 60;
- set pagesize 40;
- select deptno,empno,ename,sal from emp;
- break on deptno skip 0;
- COLUMN sal FORMAT L9999.99;
- select deptno,empno,ename,sal from emp order by 1 ASC;
- tti off;
- set linesize 80;
- set pagesize 14;
- clear break;
- column sal clear;
3、用户创建联系
1)创建用户tea和stu,并给这两个用户resource和connect权限
- create user tea identified by tea;
- grant resource to user tea;
- grant connect to user tea;
- create user stu identified by stu;;
- grant resource to user tea;
- grant connect to user tea;
2)使用scott用户把对emp表的select权限给tea
- grant select on emp to tea;
- 使用tea查询scott的emp表
- select * from emp;
- 使用scott用户把对emp表的所有权限赋给tea
- grant all on emp to tea;
- 使用tea更新、删除、插入scott的emp表
- 略
- 使用scott收回权限
- revoke all on emp from tea;
3)想办法将让tea把自己拥有的对scott.emp的权限转给stu
- grant all on emp to tea with grant option
- grant all on scott.emp to stu;
- 使用stu查询scott用户的emp表
- select * from scott.emp;
- 使用tea收回给stu的权限
- revoke all on scott.emp from stu;