一.不定项选择题.
1.下面说法正确的是[3.3分]
A. 一个表只允许有一个主键
B. 一个表可以有多个主键
C. 数据库会为主键自动创建对应的唯一索引
D. 主键只表示该字段不允许为空
考生答案:AC
2.下面能修改表名字的命令是[3.3分]
A. ALTER TABLE RENAME
B. RENAME
C. ALTER TABLE MOVE
D. ALTER TABLE MODIFY
考生答案:A
参考答案:B
3.Delete和truncate 都可以用来删除表的内容,以下描述正确的是[3.3分]
A. Truncate不需要rallbacksegment
B. Delete需要rallbacksegment
C. Truncate在提交commite之前仍可以回滚
D. Truncate还可以删除表结构
考生答案:AB
参考答案:ABD
4.下面语句错误的原因是
Update departments set department_id=300 where department_id=60; ERROR 位于第 1 行: ORA-02292: 违反完整约束条件 (HR.EMP_DEPT_FK) - 已到子记录日志[3.3分]
Update departments set department_id=300 where department_id=60; ERROR 位于第 1 行: ORA-02292: 违反完整约束条件 (HR.EMP_DEPT_FK) - 已到子记录日志[3.3分]
A. where条件语法错误
B. 违反主键约束,department_id为300的记录已经存在
C. 60号部门下已经有员工,修改60号部门编号将违反完整性约束条件
D. 60号部门不存在
考生答案:C
5.下面那个SQL命令是用于清空表中数据的DDL语句[3.3分]
A. UPDATE
B. DELETE
C. TRUNCATE
D. SELECT
考生答案:C
6.下面哪条语句可以取出薪水最高的前三个人[3.3分]
A. select * from (select * from employees order by salary );
B. select * from (select * from employees order by salary ) where rownum<=3;
C. select * from (select * from employees order by salary desc) where rownum<=3;
D. select * from employees where rownum<=3 order by salary desc;
考生答案:C
7.下面那个权限是连接数据库所需要的权限[3.3分]
A. create table
B. create session
C. create tablespace
D. create database
考生答案:B
8.下面哪种情况会使没有完成的事务“隐式”提交[3.3分]
A. 执行多个查询语句
B. 执行Commit
C. 执行create table 命令
D. 服务器掉电
考生答案:C
9.表 CLASSES 和 表 SCHEDULE 结构如下:
CLASSES:
ID NUMBER(9)
CLASS_NAME VARCHAR2(20)
TEACHER_ID NUMBER(9)
SCHEDULE:
CLASS_TIME DATE
CLASS_ID NUMBER(9)
你建一个视图显示每一课的课名、课时,并按教师ID排序 判断下面语句将返回何种结果?
CREATE VIEW class_schedule AS
SELECT C.class_name as “Name”, s.class_time
FROM classes c, schedule s
WHERE C.id = s.class_id ORDER BY teacher_id;[3.3分]
CLASSES:
ID NUMBER(9)
CLASS_NAME VARCHAR2(20)
TEACHER_ID NUMBER(9)
SCHEDULE:
CLASS_TIME DATE
CLASS_ID NUMBER(9)
你建一个视图显示每一课的课名、课时,并按教师ID排序 判断下面语句将返回何种结果?
CREATE VIEW class_schedule AS
SELECT C.class_name as “Name”, s.class_time
FROM classes c, schedule s
WHERE C.id = s.class_id ORDER BY teacher_id;[3.3分]
A. 语句创建视图 CLASS_SCHEDULE 且可产生预期结果.
B. “Name”别名有语法错误
C. 语法错误,因为视图不可基于连接查询.
D. 语法错误,因为视图不可包含 ORDER BY 子句.
考生答案:A
10.表TEACHER 包含如下字段:
列名 可为空否? 数据类型
TEACHER_ID NOT NULL NUMBER(9)
NAME VARCHAR2(25)
SALARY NUMBER(7,2)
SUBJECT_ID NOT NULL NUMBER(5)
SUBJECT_DESCRIPTION VARCHAR2(2)
你需要将理科教师的工资上浮8%,理科教师的SUBJECT_ID是011,你需用哪一句实现?[3.3分]
列名 可为空否? 数据类型
TEACHER_ID NOT NULL NUMBER(9)
NAME VARCHAR2(25)
SALARY NUMBER(7,2)
SUBJECT_ID NOT NULL NUMBER(5)
SUBJECT_DESCRIPTION VARCHAR2(2)
你需要将理科教师的工资上浮8%,理科教师的SUBJECT_ID是011,你需用哪一句实现?[3.3分]
A. UPDATE teacher salary = salary * 1.08 WHERE subject_id = 011
B. UPDATE teacher SET salary = salary *1 .08 WHERE subject_id == 011
C. UPDATE teacher SET salary = salary * 1.08 WHERE subject_id = 011
D. UPDATE teacher SET salary = salary *1 .08 WHERE subject_id like ‘%011%’
考生答案:C
11.哪句可以实现显示 id_number 和 description ,条件满足订单时间order_date在 January 1, 1997 以前的,且单价price小于 1.00 或者大于 5.00 的, 结果用订单时间降序排列。[3.3分]
A. SELECT id_number, description FROM inventory
WHERE (price < 1.00 OR price > 5.00)
AND order_date < to_date('yyyy-mm-dd','1997-01-01')
ORDER BY order_date DESC;
WHERE (price < 1.00 OR price > 5.00)
AND order_date < to_date('yyyy-mm-dd','1997-01-01')
ORDER BY order_date DESC;
B. SELECT id_number, description FROM inventory
WHERE (price < 1.00 OR price > 5.00)
AND order_date < to_date('yyyy-mm-dd','1997-01-01')
ORDER BY order_date;
AND order_date < to_date('yyyy-mm-dd','1997-01-01')
ORDER BY order_date;
C. SELECT id_number, description FROM inventory
WHERE (price < 1.00 OR price > 5.00 )
AND order_date < to_date('1997-01-01','yyyy-mm-dd')
ORDER BY order_date ASC;
WHERE (price < 1.00 OR price > 5.00 )
AND order_date < to_date('1997-01-01','yyyy-mm-dd')
ORDER BY order_date ASC;
D. SELECT id_number, description FROM inventory
WHERE (price <1.00 OR price > 5.00)
AND order_date < to_date('1997-01-01','yyyy-mm-dd')
ORDER BY order_date DESC;
WHERE (price <1.00 OR price > 5.00)
AND order_date < to_date('1997-01-01','yyyy-mm-dd')
ORDER BY order_date DESC;
考生答案:D
12.哪一子句可实现 SELECT 语句查询员工平均工资小于5000的部门信息[3.3分]
A. GROUP BY dept_id WHERE AVG(sal) < 5000
B. GROUP BY AVG(sal) HAVING AVG(sal) < 5000
C. GROUP BY dept_id HAVING AVG(sal) < 5000
D. GROUP BY AVG(sal) < 5000
考生答案:C
13.试图使用下面句子查询数据:
SELECT 100/NVL(quantity, 0) FROM inventory;
QUANTITY为 null 空值时,将导致出错,其原因是?[3.3分]
SELECT 100/NVL(quantity, 0) FROM inventory;
QUANTITY为 null 空值时,将导致出错,其原因是?[3.3分]
A. 除数表达式为空值.
B. 函数参数数据类型不一致.
C. 空值不能被转成实际值
D. 除数表达式为零.
考生答案:D
14.下列哪个集合操作符返回两个查询所选择的所有的行。[3.3分]
A. Union
B. Union all
C. Union only
D. connect by
考生答案:B
15.有如下SQL片段
Delete from emp e where e.hiredate>’14-Dec-09’and e.sal <> ‘1’其含义为:[3.3分]
Delete from emp e where e.hiredate>’14-Dec-09’and e.sal <> ‘1’其含义为:[3.3分]
A. 从表emp中删除hiredate 不小于2009年12月14日,且sal不为1的记录,一定不可恢复
B. 从表emp中删除hiredate 和 sal列
C. 对表emp中hiredate不小于2009年12月14日,且sal不为1的记录实施删除
D. 删除emp表的全部记录
考生答案:C
16.SQL语言中修改表结构的命令是[3.3分]
A. MODIFY TABLE
B. MODIFY STRUCTURE
C. ALTER TABLE
oracle数据库表结构怎么看D. ALTER STRUCTURE
考生答案:C
17.Delete和 truncate 都可以用来删除表内容,以下描述正确的是[3.3分]
A. Truncate 不需要 rollbacksegment
B. Delete 需要rollbacksegment
C. Truncate在 提交commit之前仍可回滚
D. Truncate还可以删除表结构
考生答案:A
参考答案:AB
18.下列属于DML语句的是[3.3分]
A. commit
B. update
C. delete
D. creat
考生答案:BC
19.从 “员工” 表的“姓名”字段中出名字包含“玛丽”的人,下面哪条select语句正确:[3.3分]
A. Select * from员工 where 姓名 =’_玛丽_’
B. Select * from员工 where 姓名 =’%玛丽_’
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论