利用sql语言表达复杂查询

  • Post author:
  • Post category:其他




子查询



θsome与 θall子查询



=some和in的关系同

表达式 = some(子查询)

表达式 in (子查询)

select 
Sname 
from 
Student S 
where 
S#
in(select S# from SC where S# = S.S# and C#='001');
select
Sname 
from 
Student S 
where 
S# =some (select S# from SC where S# = S.S# and C#='001');



<>all和not in的关系同

select 
Sname 
from 
Student S 
where 
S# not in(select S# from SC where S# = S.S# and C#='001');
select 
Sname 
from 
Student S
where 
S# <>al



版权声明:本文为zmjheart原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。