create table s ( s# number(3) primary key, sn char(10) , sd char(10), sa number(2) );create table c ( c# number(3) primary key, cn char(10) ); create table sc ( s# number(3) references s, c# char(10) references c, g number(2); primary key(s#,c#) );(1): select s#,sn from s where s.s# in ( select sc.s# from sc where sc.c# in ( select c# from c where cn="税收基础" ) ); (2) select sn,sd from s where s.s# in ( select sc.s# from sc where sc.c# != c5 ); (3) select sn,sd from s where not exists ( select * from c where not exists( select * from sc where s# =s.s# and c# = c.c# ) )
(
s# number(3) primary key,
sn char(10) ,
sd char(10),
sa number(2)
);create table c
(
c# number(3) primary key,
cn char(10)
);
create table sc
(
s# number(3) references s,
c# char(10) references c,
g number(2);
primary key(s#,c#)
);(1):
select s#,sn
from s
where s.s# in
(
select sc.s#
from sc
where sc.c# in
(
select c#
from c
where cn="税收基础"
)
);
(2)
select sn,sd
from s
where s.s# in
(
select sc.s#
from sc
where sc.c# != c5
);
(3)
select sn,sd
from s
where not exists
(
select *
from c
where not exists(
select *
from sc
where s# =s.s# and c# = c.c#
)
)