1 / 8

Answers:

Answers:. a. select S# from SPJ where J#=J1 and. select S# from SPJ as SPJX where J#=J1 and exists. S# in (select S# from SPJ where J#=J2).

kiefer
Download Presentation

Answers:

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Answers: a. select S# from SPJ where J#=J1 and select S# from SPJ as SPJX where J#=J1 and exists S# in (select S# from SPJ where J#=J2) (select * from SPJ as SPJY where SPJ .J#=J2 and SPJY.S#=SPJX.S#)

  2. Answers: b. select S# from SPJ where J#=any (select J# from J where CITY=‘ShangHai’ or CITY=‘BeiJing’)

  3. Answers: c. select S# from S where S.CITY=‘ShangHai’ and S.S# in (select S# from SPJ where SPJ.J in (select J# from J where J.CITY = ‘ShangHai’)) where ‘ShangHai’ in (select CITY from J where SPJ.J# =J.J#)) where exists (select * from J where SPJ.J# =J.J# and CITY=‘ShangHai’))

  4. Answers: d. select S# from S where CITY=‘BeiJing’ and ‘Red’ not in (select COLOR from P where P# in (select P# from SPJ where SPJ.S#=S.S#))

  5. Answers: d. select S# from S where CITY=‘BeiJing’ and not exists (select * from SPJ where S.S#=SPJ.S# and exists (select P# from P where COLOR=‘Red’ and SPJ.P#=P.P#))

  6. Answers: e. select J# from J where exists (select * from SPJ where J.J#=SPJ.J# and SPJ.S#=S1)

  7. Answers: f. select SNAME from S where not exists (select * from P where not exists (select * from SPJ where S.S#=SPJ.S# and SPJ.P#=P.P#))

  8. Answers: g. select S# from S where not exists g. select S# from SPJ group by S# having P# in (select * from SPJ as T where S#=‘S1’ and not exists (select P# from SPJ where S#=S1) (select * from SPJ as R where R.S#=S.S# and T.P#=R.P#))

More Related