-
Les noms des interprêtes de chansons de Serge Gainsbourgh (algebre, calcul, SQL).
Solution:
select interprete
from Interpretations, Chansons
where Interpretations.titre = Chansons.titre
and compositeur = 'Serge Gainsbourgh'
- Les titres des chansons avec plusieurs interprêtes (algebre, SQL).
Solution:
select titre
from Interpretations A, Interpretations B
where A.titre = B.titre
and A.interprete <> B.interprete
- Les titres des disques avec un seul interprête (calcul, SQL).
Solution:
{D | $ C1, I1: Interpretations(D,C1,I1) Ù
(¬ $C2, I2: Interpretations(D, C2, I2) Ù I1 <> I2)}
select disque
from Interpretations A
where not exists (select *
from Interpretations B
where A.disque = B.disque
and A.interprete <> B.interprete)
- Les compositeurs qui interprêtent leurs chansons (calcul, SQL).
Solution:
select compositeur
from Interpretations, Chansons
where Interpretations.titre = Chansons.titre
and compositeur = interprete
- Les compositeurs dont les chansons sont interprêtées par
d'autres artistes (algebre, SQL).
Solution:
pcompositeur(scompositeur<>interprete(Chansons |><| Interpretations))
select distinct compositeur
from Chansons, Interpretations
where Chansons.titre = Interpretations.titre
and compositeur <> interprete
- Les chansons pour lesquelles il n'existe pas d'interprétation
par leur compositeur (calcul, SQL).
{T| $ C : Chansons(T,C) Ù (¬ $D : Interpretations(D,T,C) }
Solution:
select titre
from Chansons
where not exists (select *
from Interpretations
where Chansons.titre = Interpretations.chanson
and compositeur = interprete)
- Le nombre de d'interprétations de chansons de Serge Gainsbourgh (SQL).
Solution:
select count(*)
from Interpretations, Chansons
where Chansons.titre = Interpretations.titre
and Chansons.compositeur = 'Serge Gainsbourgh'
- Les chansons avec plus que 20 interprétations différentes (SQL).
Solution:
select titre
from Interpretations
group by titre
having count(*) > 20
- Les chansons avec le plus d'interprétations différentes (SQL).
Solution:
select titre
from Interpretations
group by titre
having count(*) = (select max(count(*))
from Interpretations
group by titre)