-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequetes.sql
More file actions
261 lines (201 loc) · 6.78 KB
/
Requetes.sql
File metadata and controls
261 lines (201 loc) · 6.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
-- 1)
SELECT personnel.nom, scientifique.grade
FROM personnel, scientifique, encadrer
WHERE encadrer.iddoctorant = 'd001'
and encadrer.idscientifique= scientifique.idscientifique
and encadrer.idscientifique = personnel.idpersonnel
-- 2)
SELECT NewFinalTable.nom, LE.pays
FROM labexterne LE
JOIN
(
SELECT *
FROM auteurexterne AE
JOIN
(
SELECT PubliE.idauteurexterne
FROM publicationexterne PubliE
JOIN
(
SELECT Publi.idpublication
FROM publication Publi JOIN publicationpersonnel PubliP
ON Publi.idpublication = PubliP.idpublication
WHERE Publi.anneepublication >=2016 AND Publi.anneepublication <=2020
AND PubliP.idpersonnel =
(
SELECT idpersonnel
FROM personnel P
WHERE P.nom ='Azi' AND P.prenom ='Jean'
)
) AS NPE ON PubliE.idpublication = NPE.idpublication
) AS NAE ON AE.idauteurexterne = NAE.idauteurexterne
) AS NewFinalTable ON LE.idlaboratoireexterne = NewFinalTable.idlaboratoireexterne
-- 3)
SELECT Count(*)"Nombre de collaborateurs total"
FROM
(
SELECT DISTINCT PP.idpersonnel
FROM publicationpersonnel PP
WHERE PP.idpublication IN
(
SELECT PP.idpublication
FROM publicationpersonnel PP
WHERE PP.idpersonnel = 'S004'
)
UNION
SELECT DISTINCT PE.idauteurexterne
FROM publicationexterne PE
WHERE PE.idpublication IN
(
SELECT PP.idpublication
FROM publicationpersonnel PP
WHERE PP.idpersonnel = 'S004'
)
) AS collaborateurtotal
-- 4)
SELECT Count( DISTINCT AE.idlaboratoireexterne )
FROM auteurexterne AE
WHERE AE.idauteurexterne IN
(
SELECT PE.idauteurexterne
FROM publicationexterne PE
WHERE PE.idpublication IN
(
SELECT P.idpublication
FROM publication P
WHERE P.idconference IN
(
SELECT C.idconference
FROM conference C
WHERE C.classeconference LIKE 'A%'
)
)
)
-- 5)
SELECT Doctorant.iddoctorant, COUNT (Publicationpersonnel.idPublication)
FROM Publicationpersonnel, Doctorant
GROUP BY Doctorant.iddoctorant, PublicationPersonnel.idpersonnel
HAVING PublicationPersonnel.idpersonnel = Doctorant.iddoctorant
-- 6)
Select Count(Distinct doctorant.iddoctorant) as NbreDoctorants
From doctorant
where datedebutsoutenance >= Current_Date
-- 7)
SELECT nom, prenom
FROM personnel
NATURAL JOIN (SELECT idscientifique
FROM scientifique
EXCEPT
SELECT idscientifique
FROM Encadrer) as jamais
-- 8)
SELECT P.nom, P.prenom
FROM personnel P
WHERE P.idpersonnel IN
(
SELECT SC.idscientifique
FROM scientifique SC
EXCEPT
(
SELECT PP.idpersonnel
FROM publicationpersonnel PP
WHERE PP.idpersonnel LIKE 'S%'
UNION
SELECT E.idscientifique
FROM encadrer E
)
)
-- 9)
SELECT Personnel.nom, Personnel.prenom
FROM Personnel, Encadrer, Doctorant
WHERE doctorant.datedebutsoutenance > Current_Date
and Doctorant.iddoctorant =Encadrer.idscientifique
and Encadrer.idscientifique= Personnel.idpersonnel
-- 10)
SELECT idPersonnel, nom, prenom
FROM Personnel
NATURAL JOIN (SELECT encadrer.iddoctorant, COUNT (DISTINCT encadrer.idScientifique)
FROM Encadrer
GROUP BY encadrer.iddoctorant
HAVING COUNT (DISTINCT encadrer.idScientifique) = '1') as seul
-- 11)
Select iddoctorant, Count(Distinct encadrer.idscientifique) as NbreEncadrants
From encadrer
Group by iddoctorant
Having Count(Distinct encadrer.idscientifique)>3
-- 12)
SELECT idPersonnel
FROM PublicationPersonnel
EXCEPT
SELECT idPersonnel
FROM PublicationPersonnel
NATURAL JOIN (SELECT idPublication
FROM Publication
WHERE idconference != 'A') as CA
-- 13)
SELECT idpersonnel, nom, prenom
FROM Personnel
NATURAL JOIN (SELECT idscientifique
FROM Encadrer, Doctorant
GROUP BY idscientifique
HAVING COUNT (DISTINCT Encadrer.iddoctorant) = COUNT (DISTINCT Doctorant.iddoctorant)) as TOUS
-- 14)
SELECT anneePublication, COUNT (*) "nombre de publications"
FROM Publication
GROUP BY anneePublication
-- 15)
Select idetablissement, Count(Distinct idscientifique)
From chercheurenseignant
Group By idetablissement
-- 16)
-- 17)
Les scientifiques qui ont un seul projet
SELECT idPorteur
FROM ProjetLAAS
NATURAL JOIN (SELECT idPorteur, COUNT (*) "nombre de projets"
FROM ProjetLAAS
GROUP BY idPorteur
HAVING COUNT (*) = '1') as seul
-- 18)
SELECT *
FROM Scientifique
NATURAL JOIN (SELECT ParticipantProjet.idScientifique, COUNT(ParticipantProjet.idScientifique) as nombre_de_projets_participant
FROM ProjetLAAS, ParticipantProjet
Group by ParticipantProjet.idScientifique
Having COUNT (DISTINCT ProjetLAAS.idProjet) = COUNT(ParticipantProjet.idScientifique)) as tous_projets
-- 19)
SELECT *
FROM etablisement
NATURAL JOIN (SELECT idEtablissement, COUNT(*) "nombre de enseignantschercheurs"
FROM Chercheurenseignant
GROUP BY idEtablissement
HAVING COUNT (*) >= '50') as P50
-- 20)
select “personnel"."nom", "personnel". "“prenom"
from “personnel”
join(
select projcher.”idChercheur"
from(
Select max(projCher."compte") as maxcompte
from (
select count("ParticipationProjet".”"idProjet") as compte,arlene Kondo Lee Keli) ney [Lam eG met 10 ae
from "ParticipationProjet”
group by “ParticipationProjet"."idChercheur”
) as projCher
) as mproj,i
select count("ParticipationProjet"."idProjet") as compte,
“PparticipationProjet”."idchercheur”
from “ParticipationProjet”
group by “ParticipationProjet".”idChercheur”
Dee non eu
where projCher.compte = mproj.maxcompte
) as idmax on “personnel"."idpersonnel" = idmax."idChercheur";
-- 21)
SELECT Partenaire.pays
FROM Partenaire
NATURAL JOIN (SELECT idPartenaire
FROM ListePartenaire
NATURAL JOIN (SELECT ProjetLAAS.idProjet, COUNT(*) "nombre de projets participant"
FROM ProjetLAAS, ParticipantProjet
GROUP BY ProjetLAAS.idProjet
HAVING COUNT (ProjetLAAS.idProjet) = COUNT(*)) as ID) as TOUS