实验三 SQLlus常用命令使用和表的创建与操作.doc
文本预览下载声明
实验实验
一台机,实验column sal headingsalary
select empno,ename,sal from scott.emp where empno=7844;后保存。
图19
在SQLPlus 命令行输入:@a执行文件中的语句:
图20
2、查询scott.emp表中员工号与员工工资,要求在员工工资数值前加本地货币符号。
在SQLPlus命令行输入:column sal format L99999.99
select empno,sal from scott.emp;
图21
3、查询scott.emp表中员工信息,要求为查询页生成标题和注脚。标题名称为“员工信息:”,显示居中;注脚为‘制作人:’。
在SQLPlus命令行输入:ttitle center 员工信息
btitle right 制作人
select * from scott.emp;
执行后得如下的截图:
4用超级用户system登录,并建立两个普通用户如User1,User2,,并授权:
给出相应的SQL语句和运行结果:
提示:create user username identified by password;(默认建在SYSTEM表空间下)
5显示当前连接用户:show user;
给出相应的SQL语句和运行结果:
6查看系统拥有哪些用户select * from all_users;
给出相应的SQL语句和运行结果:
7以system身份登录到数据库,并修改User1用户模式的默认表空间和临时表空间分别为users和temp:
给出相应的SQL语句和运行结果:
8.锁定User2用户:
给出相应的SQL语句和运行结果:
(2)试图以User2身份登录数据库,结果如何?
给出相应的SQL语句和运行结果:
9.对User2解锁:
给出相应的SQL语句和运行结果:
10.连接User1用户,创建如下的Customer表(客户表)的 SQL 语句。
客户表
给出运行结果截图:
11连接User1用户,建立订单表Order,其结构如下表所示。
给出运行结果截图:
12 在Customer表中插入如下记录:
13 将客户表中Address的数据类型改为长度为30的字符型。
给出运行结果:
14 给Orders表添加名为“cn2”如下的约束:规定Freight属性列的值必须介于0和100之间。
给出相应的SQL语句和运行结果:
15给Orders表添加名为“cn1”如下的约束:Cno属性列的值非空。
给出相应的SQL语句和运行结果:
16.删除前面定义的名为cn1和cn2的约束。
给出相应的SQL语句和运行结果:
四、实验
reform results, economy, and political system, and culture system, and social system, and discipline check system, and party of construction system reform solid advance, tax, and financial, and price, and administrative approval, and State-owned enterprises, and ecological civilization, important field and key link reform made major progress, market in resources configuration in the of decisive role significantly enhanced, Unprecedented burst of momentum and vitality of economic and social development. XI General Secretarys speech in this regard include the reform only when there is no complete, the decisions of the CPC Central Committee on some major problems in deepening reform notes on the 18 session of ideas into the partys spirit of the reforms more difficult to move forward, the increasing u
显示全部