zl程序教程

您现在的位置是:首页 >  Java

当前栏目

课堂作业(1)

2023-02-18 16:34:00 时间

题目如下:

注意:

1.连接符号⨝在Mythtype我找了半天都没找着。只能靠关系符号来凑了。?希望各位大佬支招

2.符号的介绍:

投影(选择关系中想要的列)

选择(选择出符合规定条件的行)

连接(本文中的连接均是自然连接)

参考答案

(1)

select sno
from spj
where jno = 'j1'

  (2) 

select sno
from spj
where pno = 'p1' and jno = 'j1'

 (3)

select sno
from p,spj
where spj.pno = p.pno and jno = 'j1' and color = '红色'

  (4) 

select jno 
from j
where not exists
(select * 
 from s,p,spj
where spj.jno = j.jno
and spj.sno = s.sno
and spj.pno = p.pno
and s.city = '天津'
and p.color = '红色'
)

 (5) 

select distinct jno
from spj spjz
where not exists
(select *
from spj spjx
where sno = 's1'
and not exists
(select * 
from spj spjy
where spjx.pno = spjy.pno
and sojy.jno = spjz.jno))

        欢迎关注LI&&Tao,我在数据分析,大数据,后端,前端三件套,也都有一定的研究,如果你还有java,python爬虫方面,前端,大数据方面的问题,可以点击左边我的专栏里面查找对应的解决办法。