查询语句:selecta.snamefromyangstudentawherea.stunonotin(selectdistinctb.stunofromyangstudentbwhereb.snameisnotnull);创表语句:createtableyangclass(classnonumber(8)primar...
查询语句 :select a.sname from yangstudent a where a.stuno not in (select distinct b.stuno from yangstudent b where b.sname is not null);
创表语句:
create table yangclass(
classno number(8) primary key,
cname varchar2(20) not null
);
create table yangstudent(
stuno number(8) primary key,
sname varchar2(20) null,
sex varchar2(20) default '男',
calssno number(8),
constraint foreign key references yangclass(classno)
);
插入数据语句:
insert into yangclass(classno,cname) values(12,'yh');
insert into yangstudent(stuno,sname,sex,calssno) values(1002,'yang','男',12);
insert into yangstudent(stuno,sname,sex,calssno) values(1001,'yang2','男',12);
木有分了,不要意思哈
我想要的查询结果: select a.sname from yangstudent a where a.sname not in (select distinct b.sname from yangstudent b);
谢谢了
我要查询出yangstudent中的但又不在这个结果集:(select distinct b.sname from yangstudent b) 中的所有记录
展开