当前位置:首页 > 笔试题 - 答案
第一部分:数据库 1、选择题
(1)已知表T1中有2行数据,T2中有3行数据,执行SQL语句 “select a.*, b.* from T1 a,T2 b”后,返回的行数为______ A、2行 B、3行 C、5行 D、6行 答案:D
(2)已知表T1和T2的字段定义完全相同,T1,T2中各有5条不同的数据,其中T1有2条数据存在于表T2中,语句“select * from T1 union select * from T2”
返回的行数为_______ A、8行 B、10行 C、3行 D、12行 答案: A
(3)已知表T1含有字段ID、CourseID和Score,且数据为 ID 3 2 2 3
CourseID 1 1 2 2
Score 90 85 90 80
则语句“select id,sum(Score) from T1 group by ID”的执行结果为_________ A、 ID sum(Score)
---- ---------- 3 170 2 175
B、 ID sum(Score) —– ———- 2 175 3 170
C、 ID sum(Score) —– ———- 2 170 3 175
D、 ID sum(Score) —– ———- 3 175 2 170 答案: B
(4)电话号码表t_phonebook中含有100万条数据,其中号码字段PhoneNo上创建了唯一索引,且电话号码全部由数字组成,要统计号码头为321的电话号码的数量,下面写法执行速度最慢的是_________
A、 select count(*) from t_phonebook where phoneno >= ‘321’ and phoneno < ‘321A’
B、 select count(*) from t_phonebook where phoneno like ‘321%’ C、 select count(*) from t_phonebook where substr(phoneno,1,3) = ‘321’ 答案: C
(5)已知表tbl中字段land_ID建有索引,字段cust_id建有唯一索引,下列语句查询逻辑相同,其中执行效率最优的是 A、 SELECT * FROM tbl WHERE land_id > 750
or (cust_id=180 or cust_id=560) B、 SELECT * FROM tbl
WHERE (cust_id=180 or cust_id=560) or land_id > 750
C、 SELECT * FROM tbl WHERE land_id > 750 UNION
SELECT * FROM tbl WHERE cust_id = 180 UNION
SELECT * FROM tbl WHERE cust_id = 560 D、 SELECT * FROM tbl WHERE land_id > 750 UNION
( SELECT * FROM tbl WHERE cust_id = 180 UNION ALL
SELECT * FROM tbl WHERE cust_id = 560 ) 答案: D
(6)员工技能表Staffskill结构如下,Staff和Skill字段建有唯一约束 staff VARCHAR2(10), skill VARCHAR2(10)
哪条语句可以查询同时拥有技能A和技能B的员工
A、 select staff from Staffskill where skill=’A’ OR skill=’B’ B、 select staff from Staffskill where skill=’A’ AND skill=’B’ C、 select staff from Staffskill where skill=’A’ OR skill=’B’ group by staff
D、 select staff from Staffskill where skill=’A’ OR skill=’B’ group by staff having count(*)>1 答案:D
(7)员工表staff表结构如下 staffNo varchar2(10), Email varchar2(50)
哪一个SQL语句能查询出没有E_mail地址的员工号 A、select staffno from Staff where Email = NULL B、select staffno from Staff where Email <> NULL C、select staffno from Staff where Email is null D、select staffno from Staff where Email is not null 答案: C
(8)Oracle数据库启动步骤的顺序为 1.Mount 2.Open 3.Nomount A、3-1-2 B、2-3-1 C、2-1-3 D、3-2-1 答案:A
(9)存在两个结构相同的数据库表T1(col1,col2,col3)、T2(col1,col2,col3),写出一SQL语句将所有T1数据导入到T2表
共分享92篇相关文档