|
|
最先答对且答案未经编辑的puber将获得纪念章一枚(答案不可编辑但可发新贴补充或纠正),其他会员如果提供有价值的分析、讨论也可获得纪念章一枚。
每两周的优胜者可获得itpub奖励的技术图书一本。
以往旧题索引:
http://www.itpub.net/forum.php?m ... eid&typeid=1808
原始出处:
http://www.plsqlchallenge.com/
作者: Kim Berg Hansen
运行环境:SQLPLUS, SERVEROUTPUT已打开
注:本题给出答案时候要求给予简要说明才能得到奖品
我有一张表保存着课程信息:
create table qz_courses (
id integer primary key
, code varchar2(10) not null
, name varchar2(30)
)
/
create unique index qz_courses_code_ix on qz_courses (code)
/
insert into qz_courses values (40, 'PLSQL01', 'Control statements')
/
insert into qz_courses values (41, 'PLSQL04', 'Collection methods')
/
insert into qz_courses values (42, 'SQL10' , 'RANGE versus ROWS')
/
insert into qz_courses values (43, 'SQL16' , 'Linear regression')
/
commit
/
我想要一个有关SQL的课程的列表,按照我的定义,只要是CODE这个列里面的值是以SQL这几个字母开始的就算是。
为此我写了这个未完成的查询:
select code, name
from qz_courses
##REPLACE##
order by code
/
哪些选项包含了一个WHERE子句,可以用来取代 ##REPLACE## 使得查询返回这个输出:
CODE NAME
---------- ------------------------------
SQL10 RANGE versus ROWS
SQL16 Linear regression
(A)
where code like '^SQL'
(B)
where code like 'SQL%'
(C)
where code like '%SQL%'
(D)
where instr(code, 'SQL') = 0
(E)
where instr(code, 'SQL') = 1
(F)
where instr(code, 'SQL') > 0
(G)
where substr(code, 0, 3) = 'SQL'
(H)
where substr(code, 1, 3) = 'SQL'
(I)
where substr(code, 1) = 'SQL'
(J)
where code >= 'SQL' and code < 'SQM'
(K)
where code between 'SQL' and 'SQM'
(L)
where code between 'SQL' and rpad('SQL', 10, chr(255))
|
|