Vous êtes sur la page 1sur 17

Mini projet

Gestion etablissement
par
Salma fakhre-eddine
houda mansouri
Créer une base de données

Créer des tables (enseignant,etudiant,filiere,note,cours,salle)


create table filiere (idf varchar(8),nomf varchar(20),primary key(idf));

create table enseignant (nom varchar(25),idn varchar(8),echelle varchar(20),primary key(idn));

create table etudiant (nom varchar(25),cne varchar(8), PRIMARY key (cne),idf varchar(8),FOREIGN
key(idf) references filiere(idf));

create table cours(idc varchar(6),cours varchar (20),type varchar(15), idn varchar(8),idf


varchar(8),primary key (idc),foreign key(idn) REFERENCES enseignant(idn),foreign key(idf)
REFERENCES filiere(idf));

create table note(idnote varchar(6),note varchar(6) ,idc varchar(6),cne varchar(8),primary


key(idnote),foreign key(idc) REFERENCES cours(idc),foreign key(cne) REFERENCES etudiant(cne));

create table salle (nums varchar(4),capacity int, idc varchar(6),primary key(nums),foreign key(idc)
references cours(idc));

2
Saisir les données

3
4
5
Les requêtes

1) select nom, idf from etudiant where idf="TH"

6
2) SELECT nom,note,idc,note.cne from etudiant,note where idc="DAO" and note>11 and
etudiant.cne=note.cne

7
3)SELECT nom,note,idc,note.cne from etudiant,note where idc="DAO" and note>11 and
etudiant.cne=note.cne ORDER by note

8
4)select * from salle where capacity>40

9
5)select nom,note.cne,avg(note)from note,etudiant where nom in (select nom from etudiant where
cne=1024)and etudiant.cne=note.cne

10
6)select COUNT(nom) from enseignant,filiere where idf="TH"

11
7)select nom from enseignant,filiere where echelle="chercheur" and idf="TH"

12
8)select nom,AVG(note),note.cne,idf from note,etudiant where idf="LI" and etudiant.cne=note.cne
GROUP by cne

13
9)select N1.cne , N1.note , N2.cne,N2.note from note N1 , note N2 where N1.note=N2.note and
N1.cne>N2.cne

14
11)select nom from etudiant where nom in ( select nom from etudiant where idf="TH") and nom not
in ( select nom from etudiant where idf="LI")

15
12)select C1.capacity , C2.capacity , C1.nums , C2.nums from salle C1 , salle C2 where
C1.capacity>C2.capacity and C1.nums>c2.nums ORDER BY C1.capacity

16
17

Vous aimerez peut-être aussi