From bcf585b1cfba4354989c828a3ecb3168f3eae8b9 Mon Sep 17 00:00:00 2001 From: Santo Cariotti Date: Sat, 6 Feb 2021 22:16:00 +0100 Subject: databases: ex 3 --- Year_2/Databases/university_marks.xquery | 11 ----------- Year_2/Databases/university_marks_ex2.xquery | 12 ++++++++++++ Year_2/Databases/university_marks_ex3.xquery | 15 +++++++++++++++ 3 files changed, 27 insertions(+), 11 deletions(-) delete mode 100644 Year_2/Databases/university_marks.xquery create mode 100644 Year_2/Databases/university_marks_ex2.xquery create mode 100644 Year_2/Databases/university_marks_ex3.xquery diff --git a/Year_2/Databases/university_marks.xquery b/Year_2/Databases/university_marks.xquery deleted file mode 100644 index e2f0e4e..0000000 --- a/Year_2/Databases/university_marks.xquery +++ /dev/null @@ -1,11 +0,0 @@ - -{ -for $student in doc("university_marks.xml")//libretto -where $student/esami//voto/text()=30 -return - {$student/studente/nome/text()} - { ' ' } - {$student/studente/cognome/text()} - -} - diff --git a/Year_2/Databases/university_marks_ex2.xquery b/Year_2/Databases/university_marks_ex2.xquery new file mode 100644 index 0000000..e75616c --- /dev/null +++ b/Year_2/Databases/university_marks_ex2.xquery @@ -0,0 +1,12 @@ + +{ +for $student in doc("university_marks.xml")//libretto +where $student/esami//voto/text()=30 +return + {$student/studente/nome/text()} + { ' ' } + {$student/studente/cognome/text()} + +} + + diff --git a/Year_2/Databases/university_marks_ex3.xquery b/Year_2/Databases/university_marks_ex3.xquery new file mode 100644 index 0000000..dd1f5b8 --- /dev/null +++ b/Year_2/Databases/university_marks_ex3.xquery @@ -0,0 +1,15 @@ + +{ +let $f := doc("university_marks.xml") +let $courses := distinct-values($f//materia) + +for $course in $courses +return + { + for $data in $f//libretto + where $data//esami//esame//materia/text()=$course + return {$data//studente/@matricola} + } + +} + -- cgit v1.2.3-18-g5258