Oracle学习笔记(四)——上机练习一
来源:互联网 发布:美国移交域名管理 编辑:程序博客网 时间:2024/05/21 14:41
1、define命令可以用于定义哪种变量
a、number
b、char
c、varchar2
d、date
【b】
Host变量主要作用是起到一个替代变量的作用,是主机环境可以和oracle进行交互的一个媒介。 通过define定义host变量的时候必须指定变量名和变量的值,如果变量名已经存在于host变量中,则自动覆盖,这个值不可以指定类型,一律按char存储。
参见:http://www.2cto.com/database/201507/415266.html
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;
0 0
- Oracle学习笔记(四)——上机练习一
- 【笔记】oracle练习<一>
- ORACLE学习笔记(四)——数据库的访问
- C语言编程入门——综合练习(四)上机考试题
- Oracle学习笔记(四)
- Oracle学习笔记(四)
- Oracle学习笔记(四)
- Oracle学习笔记(四)
- oracle学习笔记(四)
- Lua 学习笔记(四) —— 函数(一)
- 上机练习项目一
- oracle学习笔记(四)
- oracle学习笔记四
- oracle 学习笔记四
- oracle学习笔记四
- oracle学习笔记(四)
- Oracle学习笔记(四)
- Oracle学习笔记(四)
- 字符串变量String的常用操作
- 在ios中自定义tabbar跳转隐藏问题
- Activity四种启动模式
- android studio新建module不生成build文件夹
- What does Logrotate do?
- Oracle学习笔记(四)——上机练习一
- HDOJ 1789-Doing Homework again【贪心】
- 常用链接
- jQuery的效果
- div 居中
- 文章标题
- Django Start
- LeetCode *** 129. Sum Root to Leaf Numbers
- const、#define、typedef和inline的区别