select titre, prix, type, periode from journal;
select titre from journal order by titre;
select code_j from journal where periode = 'MENSUEL';
select * from journal order by type, prix;
select journal.code_j, n_dep from journal, livraison where journal.code_j = livraison.code_j order by journal.code_j;
select min(prix), avg(prix), max(prix) from journal;
select count(distinct titre), count(distinct type) from journal;
select code_j from journal where type is null;
select type, min(prix), avg(prix), max(prix) from journal group by type;
select n_dep from livraison group by n_dep having avg(qte_l) > 15;
select adr_j from journal group by adr_j having count(distinct code_j) >= 5;
select count(distinct adr_j) from journal where adr_j in (select adr_j from journal group by adr_j having count(distinct code_j) >= 4);
select distinct code_j from depot, livraison where depot.n_dep = livraison.n_dep and adr like 'BURES%';ou
select distinct code_j from livraison where n_dep in (select n_dep from depot where adr like 'BURES%');
select distinct code_j from livraison, depot where livraison.n_dep=depot.n_dep and nom_dep like 'LES BRASSEURS%';
select distinct titre from journal, livraison, depot where livraison.n_dep=depot.n_dep and journal.code_j=livraison.code_j and nom_dep like 'LES BRASSEURS%';
select count(distinct titre), sum(qte_l) from journal, livraison, depot where livraison.n_dep=depot.n_dep and journal.code_j=livraison.code_j and nom_dep like 'LES BRASSEURS%';
select distinct code_j, titre from journal where prix > (select 2*min(prix) from journal);
select n_dep from livraison group by n_dep having count(distinct code_j) > 1;
select n_dep from livraison a where date_l in (select date_l from livraison b where a.n_dep=b.n_dep group by date_l having sum(qte_l) > 50) group by n_dep having count(distinct date_l) > 2;
select titre from journal, livraison, depot where journal.code_j=livraison.code_j and livraison.n_dep=depot.n_dep and adr like 'PARIS%' group by titre having count(distinct livraison.n_dep) >= 5;
select distinct nom_dep from depot where n_dep not in (select n_dep from livraison, journal where livraison.code_j = journal.code_j and titre like 'LIBERATION%');
select distinct n_dep from livraison, journal where livraison.code_j = journal.code_j and periode = 'HEBDO' and n_dep not in (select n_dep from livraison, journal where livraison.code_j = journal.code_j and periode <> 'HEBDO');
select code_j from journal;
select code_j from journal where code_j not in (select code_j from livraison where n_dep = '007');
select code_j from livraison where n_dep = '007';
select n_dep from depot where not exists (select * from journal where code_j not in (select code_j from livraison where depot.n_dep = livraison.n_dep));
select titre from journal where type='FEMININ' and PERIODE='MENSUEL';
select titre from journal where type='FEMININ' and periode='MENSUEL' and code_j not in (select code_j from livraison where n_dep = '007');
select n_dep from depot where not exists (select * from journal where type='FEMININ' and PERIODE='MENSUEL' and code_j not in (select code_j from livraison where depot.n_dep = livraison.n_dep));
select n_dep from depot where adr like 'PARIS%';
select n_dep from depot where adr like 'PARIS%' and not exists (select * from journal where code_j not in (select code_j from livraison where depot.n_dep = livraison.n_dep));
select n_dep from depot where adr like 'PARIS%' and not exists (select * from journal where type='FEMININ' and PERIODE='MENSUEL' and code_j not in (select code_j from livraison where depot.n_dep = livraison.n_dep));
select titre from journal where type='FEMININ' and PERIODE='MENSUEL' and not exists (select * from depot where not exists (select * from livraison where livraison.code_j = journal.code_j and livraison.n_dep = depot.n_dep));
©S. Abiteboul, E. Waller, B. Amann