Académique Documents
Professionnel Documents
Culture Documents
--q1
select numFil,nomFil from filiere
--q2
select numFil,nomFil from
filiere f inner join secteur s on f.codeSec=s.codeSec
where nomSec='tertiaire'
--q3
select * from stagiaire
where sexeStag='f'
--q4
select * from stagiaire
where sexeStag='m'
--q5
select m.numMod, nomMod from module m inner join programme p on
p.numMod=m.numMod inner join filiere f on f.numFil=p.numFil
where nomfil='tdm'
--q6
select m.numMod, nomMod from module m inner join programme p on
p.numMod=m.numMod inner join filiere f on f.numFil=p.numFil inner
join secteur s on s.codeSec=f.codeSec
where nomSec='industriel'
--q7
select numstag, nomstag from stagiaire s
where not exists (select * from notation n where n.numStag=
s.numStag)
--q8
select numstag, nomstag from stagiaire s
where not exists (select * from notation n inner join module m on
m.numMod=n.numMod where n.numStag= s.numStag and m.numMod=5)
--q9
select count(numfil) as [nombre total de filiere]
from filiere
--10
select f.numFil,nomfil, count(m.nummod)
from module m inner join programme p on p.numMod=m.numMod inner join
filiere f on p.numFil=f.numFil
group by f.numfil, nomFil
--11
select f.numFil,nomfil, count(m.nummod)
from module m inner join programme p on p.numMod=m.numMod inner join
filiere f on p.numFil=f.numFil inner join secteur s on
f.codeSec=s.codeSec
where nomSec='tertiaire'
group by f.numfil, nomFil
--12
select f.numFil, f.nomFil
from filiere f inner join programme p on p.numFil=f.numFil
group by f.numFil, f.nomFil
having count(f.numfil)>2
--13
select nomstag
from stagiaire
where DATEDIFF(year,datenais,getdate())<20
--14
select n.numStag, m.numMod, m.nomMod, n.note, p.coef
from notation n inner join module m on n.numMod=m.numMod inner join
programme p on p.numMod=m.numMod
where n.numStag=20
--15
select m.numMod
from module m
where(select count(p.numMod) from programme p where
m.numMod=p.numMod)=(select count(*) from module)
--méthode 2
select *
from module m
where
not exists
(select *
from filiere f
where not exists (select * from programme p where f.numFil=p.numFil
and m.numMod=p.numMod))
--méthode 3
select m.numMod, m.nomMod
from module m inner join programme p on p.numMod=m.numMod
group by m.numMod, m.nomMod
having count(numFil)=(select count(numFil) from filiere)
--16
select m.nomMod, m.nomMod
from module m inner join programme p on p.numMod=m.numMod inner join
filiere f on p.numFil=f.numFil inner join secteur s on
f.codeSec=s.codeSec
group by m.numMod, m.nomMod
having count(*) = (select count(numfil) from filiere f inner join
secteur s on f.codeSec=s.codeSec and nomSec='industriel')
--17
select m.numMod, m.nomMod
from module m inner join programme p on p.numMod=m.numMod inner join
filiere f on f.numFil=p.numFil inner join secteur s on
s.codeSec=f.codeSec
where s.nomSec='industriel'
and m.numMod not in (select m.numMod from programme p inner join
filiere f on f.numFil=p.numFil inner join secteur s on
s.codeSec=f.codeSec
where s.nomSec='tertiaire' )
--18
select f.numFil,f.nomFil
from filiere f inner join programme p on p.numFil=f.numFil
group by f.numFil,f.nomFil
having count(numMod)>=all(select count(numMod) from programme group
by numFil)
--19
select s.numStag
from stagiaire s inner join notation n on n.numStag=s.numStag inner
join module m on m.numMod=n.numMod inner join programme p on
n.numMod=p.numMod
group by s.numStag
having (sum(note*coef)/sum(coef))>=all(select
sum(note*coef)/sum(coef) from stagiaire s inner join notation n on
n.numStag=s.numStag inner join module m on m.numMod=n.numMod inner
join programme p on n.numMod=p.numMod
group by s.numStag)