Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views1 page

SQL Views for Student Evaluations

The document outlines a series of SQL commands to create and manipulate views related to student evaluations and performance metrics. It includes creating views for restricted student data, average scores, evaluation failures, and success percentages, along with updates and error handling. The document also highlights specific queries to extract data based on certain conditions, such as students with scores between 5 and 10 and those who have failed all evaluations.

Uploaded by

khadby076
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

SQL Views for Student Evaluations

The document outlines a series of SQL commands to create and manipulate views related to student evaluations and performance metrics. It includes creating views for restricted student data, average scores, evaluation failures, and success percentages, along with updates and error handling. The document also highlights specific queries to extract data based on certain conditions, such as students with scores between 5 and 10 and those who have failed all evaluations.

Uploaded by

khadby076
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

CREATE VIEW Etudiant_Restricted AS SELECT matricule, nom, prenom, sexe, ville,


idDep FROM etudiant
2. SELECT * FROM Etudiant_Restricted
3. CREATE VIEW vMoyEtudiant AS SELECT e.matricule, e.nom, e.prenom,
AVG(ev.noteEX) AS moyenne_noteEX FROM etudiant e JOIN evaluation ev ON
e.matricule = ev.matricule GROUP BY e.matricule, e.nom, e.prenom
4. SELECT * FROM vMoyEtudiant
5. SELECT matricule, nom FROM vMoyEtudiant WHERE moyenne_noteEX = (SELECT
MAX(moyenne_noteEX) FROM vMoyEtudiant)
6. CREATE VIEW vEvaluation AS SELECT * FROM Evaluation WHERE noteEX < 10
7. UPDATE vEvaluation SET noteEX = noteEX + 2
8. L
9. drop view vEvaluation; et CREATE VIEW vEvaluation AS SELECT * FROM Evaluation
WHERE noteEX < 10 WITH CHECK OPTION
10. UPDATE vEvaluation SET noteEX = noteEX + 2 et ERROR 1369 (HY000): CHECK
OPTION failed 'l3bda.vevaluation'
11. CREATE VIEW vPourcentageReussite AS SELECT m.CodeM AS CodeModule, m.titre
AS NomModule, COUNT(CASE WHEN ev.noteEX >= 10 THEN 1 END) * 100.0 /
COUNT(*) AS PourcentageReussite FROM Module m JOIN Evaluation ev ON
m.CodeM = ev.CodeM GROUP BY m.CodeM, m.titre; SELECT * FROM
vPourcentageReussite
12. CREATE VIEW vEtudiantsNotes5_10 AS SELECT e.matricule AS MatriculeEtudiant,
e.nom AS NomEtudiant, ev.CodeM AS CodeModule, ev.noteEX AS NoteExamen
FROM etudiant e JOIN Evaluation ev ON e.matricule = ev.matricule WHERE
ev.noteEX BETWEEN 5 AND 10; et SELECT * FROM vEtudiantsNotes5_10 WHERE
CodeModule = 'BD'
13. CREATE VIEW vMaxNoteParModule AS SELECT e.matricule AS MatriculeEtudiant,
e.nom AS NomEtudiant, ev.CodeM AS CodeModule, ev.noteEX AS NoteMax FROM
Evaluation ev JOIN etudiant e ON ev.matricule = e.matricule WHERE ev.noteEX =
( SELECT MAX(noteEX) FROM Evaluation subEv WHERE subEv.CodeM = ev.CodeM)
; SELECT * FROM vMaxNoteParModule
14. CREATE VIEW vEtudiantsEchecTotal AS
15. -> SELECT
16. -> e.matricule AS MatriculeEtudiant,
17. -> e.nom AS NomEtudiant
18. -> FROM
19. -> etudiant e
20. -> WHERE
21. -> NOT EXISTS (
22. -> SELECT 1
23. -> FROM Evaluation ev
24. -> WHERE ev.matricule = e.matricule
-> AND ev.noteEX >= 10

);

SELECT * FROM vEtudiantsEchecTotal

You might also like