You are on page 1of 2

12/11/2018 Les requêtes SELECT - Base de données STAGIAIRES - SQL - Cours et Exercices corrigés

//Q1
select * from Stagiaires;

//Q5
select * from Stagiaires order by NumS DESC;

//Q6
select * from Examens where Salle='A2' or Salle='A3';
select * from Examens where Salle in ('A2', 'A3');

//Q7
select * from Examens where TypeE='P';

//Q8
select * from Examens where TypeE='P' order by Date;

//Q9
select * from Examens order by Salle, Date DESC;

//Q11
select NumS, NumE, Note from PasserExamen where NumS='S01' and Note >= 15;

//Q12
select * from Stagiaires where NomS like '%u%';

//Q13
select distinct PrenomS from Stagiaires where PrenomS like '%m';

//Q14
select PrenomS from Stagiaires where PrenomS like '%m' or PrenomS like '%d' ;
select PrenomS from Stagiaires where PrenomS like '%[dm]' ;

//Q16
select NomS from Stagiaires where NomS like '_a%';

//Q17
select NomS from Stagiaires where NomS not like '_a%';
select NomS from Stagiaires where NomS like '_[b-zB-Z ]%';
select NomS from Stagiaires where NomS like '_[^a]%';

//Q19
select Salle from Examens

//Q20
select distinct Salle from Examens

//Q21
select NumE, max(Note) 'Premiere Note', min(Note) 'Derniere Note' from PasserExamen group by N

//Q22
http://www.exelib.net/sql/les-requete-select-base-de-donnees-stagiaires.html#solution-tab 1/2
12/11/2018 Les requêtes SELECT - Base de données STAGIAIRES - SQL - Cours et Exercices corrigés

select NumE, max(Note) as 'Premiere Note', min(Note) 'Derniere Note' from PasserExamen where N

//Q23
select NumE, max(Note) - min(Note) 'Ecart' from PasserExamen group by NumE;

//Q24
select count(*) [Nombre Examen Pratique] from Examens where TypeE='P';

//Q25
select min(Date) as 'Date 1er Examen' from Examens;

//Q26
select count(*) 'Nb stagiaire..' from Stagiaires where NomS like '%[bs]%';

//Q27
select NumS, max(Note) from PasserExamen group by NumS;

//Q28
select Date, count(*) as 'Nb Examen' from Examens group by Date;

//Q29
select Salle, count(*) as 'Nb Examen' from Examens group by Salle;

//Q30
select count(*) as 'Nb Examen' from Examens where Salle='B5';

//Q31
select Salle, count(*) as 'Nb Examen' from Examens group by Salle having count(*) > 1;

//Q32
select Salle, count(*) as 'Nb Examen' from Examens group by Salle having count(*) = 3;

//Q33
select count(*) as 'Nb Examen' from Examens where Salle like 'A%';

//Q34
select Salle, count(*) as 'Nb Examen' from Examens where Salle like 'A%' group by Salle;

//Q35
select Salle, count(*) as 'Nb Examen' from Examens where Salle like 'A%' group by Salle having

http://www.exelib.net/sql/les-requete-select-base-de-donnees-stagiaires.html#solution-tab 2/2

You might also like