1 ------------------------------------------- CONNECT TO ES; select distinct nome, marca, modello from ES.prodotti, ES.catalogo where codiceProdotto = prodotto and costo < 2000; 2 ------------------------------------------- CONNECT TO ES; select distinct ES.fornitori.nome from ES.prodotti, ES.catalogo, ES.fornitori where codiceProdotto = prodotto and fornitore = codiceFornitore and marca ='IBM'; 2b ----------------------------------------- CONNECT TO ES; select distinct ES.fornitori.nome from ES.prodotti INNER JOIN (ES.catalogo INNER JOIN ES.fornitori ON ES.catalogo.fornitore = ES.fornitori.codiceFornitore) ON ES.prodotti.codiceProdotto = ES.catalogo.prodotto where marca ='IBM'; 3 ------------------------------------------- CONNECT TO ES; select distinct c1.prodotto from ES.catalogo c1, ES.catalogo c2 where c1.prodotto = c2.prodotto and c1.fornitore > c2.fornitore; 4a ------------------------------------------ CONNECT TO ES; create view fornituraMancante as select c1.fornitore, c2.prodotto from ES.catalogo c1, ES.catalogo c2 except select fornitore, prodotto from ES.catalogo; select fornitore from ES.catalogo except select fornitore from fornituraMancante; 4b ------------------------------------------ CONNECT TO ES; select distinct fornitore from ES.catalogo c1 where not exists (select * from ES.catalogo c2 where not exists (select * from ES.catalogo c3 where c2.prodotto = c3.prodotto and c1.fornitore = c3.fornitore)); 5 ------------------------------------------- CONNECT TO ES; create view catalogoIBM as select c.fornitore, c.prodotto from ES.catalogo c, ES.prodotti p where marca = 'IBM' and p.codiceProdotto=c.prodotto; select distinct fornitore from catalogoIBM c1 where not exists (select * from catalogoIBM c2 where not exists (select * from catalogoIBM c3 where c2.prodotto = c3.prodotto and c1.fornitore = c3.fornitore)); 5b ------------------------------------------ CONNECT TO ES; create view catalogoIBM as select c.fornitore, c.prodotto from ES.catalogo c, ES.prodotti p where marca = 'IBM' and p.codiceProdotto=c.prodotto; create view fornituraMancanteIBM as select c1.fornitore, c2.prodotto from catalogoIBM c1, catalogoIBM c2 except select fornitore, prodotto from catalogoIBM; select fornitore from catalogoIBM except select fornitore from fornituraMancanteIBM; 6 -------------------------------------------- select f2.codiceFornitore, f2.nome, count(*) as SommaProdotti from ES.fornitori f2, ES.catalogo c2 where f2.codicefornitore = c2.fornitore group by f2.codiceFornitore, f2.nome having count(*) >= all ( select count(*) from ES.catalogo c group by c.fornitore ); 7 ------------------------------------------------ CONNECT TO ES; select c.prodotto, c.fornitore, f.nome from ES.catalogo c, ES.fornitori f where f.codiceFornitore = c.fornitore and costo <= all ( select costo from ES.catalogo c1 where c.prodotto = c1.prodotto);