1

Topic: Requests. Aggregate functions. The help is very necessary

Hello! I suffer already some time, with three requests. It is impossible anything, too difficult for me. Help to implement them, please!!!
Requests:
Drugstores in which there are medicines, no given vendor;
Steams of vendors which do not have any identical medicine;
Drugstores in which there are all medicines.
P.S. In .rar everything that is necessary for performance: the chart /, the filled tables and a file in a format bak.

2

Re: Requests. Aggregate functions. The help is very necessary

Steams of vendors which do not have any identical medicine

with p as (select the Vendor, the Medicine from the Table)
select p1. The vendor, p2. The vendor
from p as p1 inner join p as p2 on p1. The vendor <p2. The vendor
where not exists (select * from p as pp1 inner join p as pp2 on pp1. A medicine = pp2. A medicine where pp1. The vendor = p1. The vendor and pp2. The vendor = p2. The vendor)

3

Re: Requests. Aggregate functions. The help is very necessary

Peklov wrote:

drugstores in which there are medicines, no given vendor;

not exists () to you in the help.

Peklov wrote:

steams of vendors which do not have any identical medicine;

select
m1.name_manufacturer, m2.name_manufacturer
from
manufacturer m1 join
manufacturer m2 on m2.id_manufacturer> m1.id_manufacturer
where
not exists (
select id_medicament from manuf_medicament where id_manufacturer = m1.id_manufacturer
intersect
select id_medicament from manuf_medicament where id_manufacturer = m2.id_manufacturer
);
Peklov wrote:

drugstores in which there are all medicines.

Read about relational division.

4

Re: Requests. Aggregate functions. The help is very necessary

Many thanks for answers!