您的位置:首页 > 职场人生

软通动力华为项目组面试题_新(带答案)

2015-06-26 11:12 549 查看
一 单选题

1 Select 语句中用来连接字符串的符号是______ C

A +

B &

C ||

D |

2 select substr(to_char(date,'yyyymmdd'),1,4) from hr_dept; 现要对字段:date 取别名为:当前年份,如下操作正确的是 B

A as '当前年份'

B "当前年份"

C {当前年份}

D '当前年份'

3 提取同部门,同岗位,最高工资的语句是下面哪个:B

A select dept_id, job_id,max(salary) from employees where salary > max(salary);

B select dept_id, job_id,max(salary) from employees group by dept_id,job_id;

C select dept_id, job_id,max(salary) from employees;

D select dept_id, job_id,max(salary) from employees group by dept_id;

4 提取表A和表B中,所有的员工编号,统计出来的编号必须唯一,以下正确的是 B

A select emp_id from A ,B;

B select emp_id from A unix select emp_id from B;

C select emp_id from A unix all select emp_id from B;

D select emp_id from A ,B where A.emp_id=B.emp_id;

5 下面关于exists的使用,正确的是 C

A select service_number from services exists length(service_number)=11;

B select service_number from services exists (length(service_number)=11);

C select service_number from services where exists (length(service_number)=11);

D select service_number from services where exists length(service_number)=11;

6 下面关于null的使用,正确的是 B

A select * from hr_emp where emp_id=null;

B select * from hr_emp where emp_id is null;

C select * from hr_emp where emp_id <> null;

D select * from hr_emp where emp_id != null;

7 下面关于spool的使用正确的是 D

A spool to "路径名"

B spool to '路径名'

C spool to 路径名

D spool "路径名"

8 sqlplus中如何设定显示的宽度 A

A set line

B set pagesize

C set width

D set length

9 新建用户,如果要连接数据库,必须首先为其授予那种权限 A

A grant create session

B grant create any table

C grant create an index

D grant create user

10 下面关于视图描述错误的是:C

A 视图是基于一个表或多个表或视图的逻辑表

B 可以通过对视图的修改,完成对表数据的修改

C 本身包含表中数据

D 视图是存储在数据字典里的一条select语句

11 下面关于索引描述错误的是:D

A 类似书的目录结构

B 与所索引的表是相互独立的物理结构

C 插入、删除、更新表后,自动更新索引

D 使用索引,就一定可以加快DML(数据操作语句)速度

12 select floor(2345.67) from dual; B

A 2345.67

B 2345

C 2346

D 2000

13 select ceil(3.1415927) from dual; C

A 3.14

B 3.2

C 4

D 3

14 select add_months(to_date( '2006-05-31 00:00:00 ', 'yyyy-mm-dd hh24:mi:ss '),1) from dual; A

A 2006-06-30

B 2006-06-31

C 2006-05-31

D 2006-06-01

15 表的记录如下

emp_id emp_name

136 a

137 b

138 c

136 aa

137 bb

select count(distinct emp_id),count(*) from hr_emp;的结果为: C

A 5,5

B 4,5

C 3,5

D 3,3

16 以下不是oracle中的数据类型的是 C

A int

B integer

C varchar

D char

17 下面对实例的描述正确的是: D

A 一个数据库可以有多个实例

B 一个数据库只能有一个实例

C 两个数据库可以用同一个实例

D 实例名就是数据库的网络服务名

18 下面关于rownum的使用中,可以找到记录的是:C

A select * from tt where rownum>2;

B select * from tt where rownum>=2;

C select * from tt where rownum<2;

D select * from tt where rownum=0;

19 下面不属于ddl(数据定义语言)的是:B

A alter

B delete

C truncate

D create

20 杀掉一个用户的进程,必须知道那两个值:B

A SID, Process ID

B SID, Serial #

C Serial #, Process ID

D None of the above

答案:1-5

二 多选题

1 以下能达到字符串连接的是:CD

A +

B &

C ||

D CONCAT()

2 下列属于DML语句的有:AB

A update

B insert

C truncate

D alter

3 提取各部门总人数大于400,并且位于gd的部门 BC

A select dept_no from dept where locate='gd' and count(*)>400;

B select dept_no from dept where locate='gd' group by dept_no having count(*)>400;

C select dept_no from dept where locate='gd' having count(*)>400 group by dept_no;

D select dept_no from dept having count(*)>400 where locate='gd' group by dept_no;

4 下面关于子查询正确的有 ABC

A select * from tableA where id in (select * from tableA a where a.id=45);

B select * from tableA a where id in (select * from tableB b where a.id=b.id);

C select * from tableA where id not in (select * from tableA a where a.id=45);

D select * from tableA where id in (select * from tableB b where a.id=b.id);

5 下面关于decode 的使用错误的有:BC

A SELECT DECODE( SIGN(5 -6), 1 'Is Positive', -1, 'Is Nagative', 'Is Zero') from dual;

B SELECT DECODE( SIGN(5 -6), 1 ,'Is Positive', -1, 'Is Nagative', 'Is Zero') from dual;

C SELECT DECODE( SIGN(5 -6), 1 ,'Is Positive', -1, 'Is Nagative') from dual;

D SELECT DECODE( SIGN(5 -6), 1 ,'Is Positive', -1, 'Is Nagative' 'Is Zero') from dual;

三 判断题

1 在oracle中,不能使用存储过程来调用函数 错

2 在使用order by 时,默认是按照字段的降序排列的 对

3 在oracle中不能创建ODBC,因为ODBC是SQL SERVER的产品 错

4 在oracle中字符类型有:char,varchar2 两者之间没有区别 错

5 可以通过alert log,查看数据库引擎的报错 对

6 在游标的使用过程中,必须打开游标,使用完后,一定要关闭游标 对

7 在插入数据时,新增数据中,不得有空格 错

8 日期类型的数据,可以直接转换成数字类型 错

9 在使用分组函数GROUP BY 时,只要select后的字段不带有聚合函数的都要加入到group by 的后面进行分组 对

10 会话级的临时表在提交commit、rollback,就将表中的数据删除 错

四 简答题

1 请描述DELETE ,TRUNCATE ,DROP 三者的区别



2 表table_1中的数据如下:

number

1388

1488

1388

3333

3333

4578

2222

4444

1488

请提取出表中number,记录中不得重复

答案:select number from table_1 where rowid in (select max(rowid) from table_1 group by number);



3 修改错误

declare

cursor v_cur as select seqno,subject from user1.trans_his

where Subject ='下发成功'

createtime>=to_date('20090817','yyyymmdd') createtime 前少逻辑运算符,可以是and或or

and createtime<to_date('20090901','yyyymmdd');

cursor v_cur_b is

select seqno,Mobilenum,Readcount from user2.user_infor@local_gd

where seqno = (select seqno from op_xg_mail_notify) seqno 后是 in ,不是 =

and createtime >=to_date('20090817','yyyymmdd')

and createtime<to_date('20090901','yyyymmdd');



vseqno varchar2(30);

vseqno1 varchar2(30);

vsubject varchar2(300);

vreadcount varchar2(30);

vMobilenum varchar2(300);

begin

open v_cur;

loop

fetch v_cur.seqno,subject into vseqno,vsubject ; subject前少游标v_cur.

insert into op_xg_mail_notify values (vseqno,vsubject);

commit;

exit when v_cur%notfound;

end loop;

此处缺少关闭游标语句:close v_cur

open v_cur_b; 不需要此句,应该删掉

for cur_user in v_cur_b loop

insert into op_xg_mail_notify_user values (vseqno,vMobilenum,vreadcount); vseqno,vMobilenum,vreadcount字段前必须加游标cur_user.

commit;

exit when v_cur_b%notfound; 此句不需要

close v_cur_b; 此句不需要

end loop;

没有结束符:end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: