已采納回答 / Johnny_t
select 1 from dual where null != null;select 1 from dual where null is null;
2019-04-25
select t.ci_id, (select wm_concat(STU_NAME) from PM_STU t1
where instr(STU_IDS,t1.stu_id)>0) STU_NAME from PM_CI t
where instr(STU_IDS,t1.stu_id)>0) STU_NAME from PM_CI t
2019-04-16
--答案
select c.ci_id,wm_concat(s.stu_name)
from pm_ci c left join pm_stu s on
instr(c.stu_ids,s.stu_id)>0 group by c.ci_id;
select c.ci_id,wm_concat(s.stu_name)
from pm_ci c left join pm_stu s on
instr(c.stu_ids,s.stu_id)>0 group by c.ci_id;
2019-04-03
--插入表pm_stu數(shù)據(jù)
insert into pm_stu (STU_ID, STU_NAME)
values ('1', '張三');
insert into pm_stu (STU_ID, STU_NAME)
values ('2', '李四');
insert into pm_stu (STU_ID, STU_NAME)
values ('3', '王五');
insert into pm_stu (STU_ID, STU_NAME)
values ('4', '趙六');
insert into pm_stu (STU_ID, STU_NAME)
values ('1', '張三');
insert into pm_stu (STU_ID, STU_NAME)
values ('2', '李四');
insert into pm_stu (STU_ID, STU_NAME)
values ('3', '王五');
insert into pm_stu (STU_ID, STU_NAME)
values ('4', '趙六');
2019-04-03
--插入表pm_ci數(shù)據(jù)
insert into pm_ci (CI_ID, STU_IDS)
values ('1', '1,2,3,4');
insert into pm_ci (CI_ID, STU_IDS)
values ('2', '1,4');
insert into pm_ci (CI_ID, STU_IDS)
values ('1', '1,2,3,4');
insert into pm_ci (CI_ID, STU_IDS)
values ('2', '1,4');
2019-04-03
--建表語句
create table pm_ci
(
ci_id VARCHAR2(20) not null,
stu_ids VARCHAR2(100)
);
create table pm_stu
(
stu_id VARCHAR2(20) not null,
stu_name VARCHAR2(100)
);
create table pm_ci
(
ci_id VARCHAR2(20) not null,
stu_ids VARCHAR2(100)
);
create table pm_stu
(
stu_id VARCHAR2(20) not null,
stu_name VARCHAR2(100)
);
2019-04-03
已采納回答 / Amousy
<...code...>用distinct可以找到不重復(fù)記錄,
select?distinct?mgr?from?emp?where?mgr?is?not?null;上面這條語句的功能可以找到所有老板。很明顯King(7839)是包括在里面的,為什么select * from e...
2019-03-24
select 課程名, wm_concat(學(xué)生姓名|| '、') 選課學(xué)生 from
(select * from
(select c.ci_id 課程名, s.stu_name 學(xué)生姓名,
instr(c.stu_ids, s.stu_id) choose
from pm_ci, pm_stu s
where instr(c.ci_id, s.stu_name) is not null)
where choose=1) group by 課程名;
(select * from
(select c.ci_id 課程名, s.stu_name 學(xué)生姓名,
instr(c.stu_ids, s.stu_id) choose
from pm_ci, pm_stu s
where instr(c.ci_id, s.stu_name) is not null)
where choose=1) group by 課程名;
2019-03-01
select a.CI_ID,to_char(
(select wm_concat(decode(instr(a.stu_ids,b.stu_id),0,null,b.stu_name))
from pm_stu b
)
) STU_NAME
from pm_ci a where a.ci_id is not null;
(select wm_concat(decode(instr(a.stu_ids,b.stu_id),0,null,b.stu_name))
from pm_stu b
)
) STU_NAME
from pm_ci a where a.ci_id is not null;
2019-02-15
select a.CI_ID,to_char(
(select wm_concat(decode(instr(a.stu_ids,b.stu_id),0,null,b.stu_name))
from pm_stu b
)
) STU_NAME
from pm_ci a;
(select wm_concat(decode(instr(a.stu_ids,b.stu_id),0,null,b.stu_name))
from pm_stu b
)
) STU_NAME
from pm_ci a;
2019-02-15
最贊回答 / puikiri
就近原則,如果子查詢內(nèi)有符合 ‘emp’ 的 表/集合,就采用子查詢內(nèi)的,所以第二條語句的emp.deptno用的是子查詢內(nèi)的而不是子查詢外的。
2019-01-18