select J#,S# from J,S
where
(select count (distinct P#) from SPJ
where SPJ.S#=S.S#) =
(
select count(distinct SPJ.P#) from SPJ , SPJ SPJ1
where
SPJ.J#=J.J# and
SPJ.P# =SPJ1.P# and
SPJ1.S#=S.S#
)
create view CEP as
select distinct EmployeeID,CustomerID,ProductID
from
Orders,[Order Details]
where
Orders.OrderID=[Order Details].OrderID
select CustomerID from Customers
where
not exists
(select * from CEP t1
where
t1.CustomerID=Customers.CustomerID and
exists(select * from CEP t2 where
t2.EmployeeID=t1.EmployeeID and
not exists( select * from CEP t3 where
t3.ProductID=t2.ProductID and
t3.EmployeeID=t1.EmployeeID and
t3.CustomerID=Customers.CustomerID)))
select J#,S# from J,S
where
(select count (distinct P#) from SPJ
where SPJ.S#=S.S#) =
(
select count(distinct SPJ.P#) from SPJ , SPJ SPJ1
where
SPJ.J#=J.J# and
SPJ.P# =SPJ1.P# and
SPJ1.S#=S.S#
)
zad 11
select distinct spj1.J# from SPJ spj1 , SPJ spj2 where spj2.S# = 's4' and spj1.P# = spj2.P#
Wyszukiwarka
Podobne podstrony:
Nowy dokument tekstowyNowy Dokument tekstowySWIATLAa Nowy Dokument tekstowyNowy Dokument tekstowyNowy Dokument tekstowy(1)Nowy Dokument tekstowyNowy Dokument tekstowyNowy dokument tekstowyNowy Dokument tekstowy (2)Nowy dokument tekstowyNowy Dokument tekstowyNowy Dokument tekstowy (2)Nowy Dokument tekstowyNowy Dokument tekstowywięcej podobnych podstron