← Back
ExamFirst midtermExam paper onlyItalian

28 11 13S

Study material for Basi di Dati, shared by the Studwiz community and reviewed by moderators.

Basi di DatiFirst midterm

Document information

What's included in this study material

Study material for Basi di Dati, shared by the Studwiz community and reviewed by moderators.

Import quality: text was extracted directly from the original document.

Extracted content from the document

Representative passages recognised in different parts of the material. The full extracted text remains available to search, while this compact preview makes the page easier to read.

Page 1

12/9/13 1 Basi di dati: appello 28/11/13 Si consideri il seguente schema di base di dati che vuole tenere traccia delle informazioni relative all’anno scolastico corrente di una scuola elementare di Milano. INSEGNANTE (CF, Nome, Cognome, Indirizzo, Città, Tel) CLASSE (Anno, Sezione, Aula) ORARIO (Maestra, Anno, Sezione, Giorno, OraInizio, Materia, NumeroOre) COMP_CLASSE (Anno, Sezione, Bambino) BAMBINO (CF, Nome, Cognome, Indirizzo, Città, Tel) Linguaggi Formali Esprimere in algebra e calcolo relazionale la seguente query: Estrarre nome e cognome degli insegnanti che insegnano in almeno due classi diverse ma non iniziano mai prima della 10.30. - ORARIO INSEGNANTE ΠMaestra ORARIO ORARIO ΠMaestra, Anno, Sezione ρ A←Anno, S←Sezione, σAnno<>A ∨Sezione <>S σOrario<=10.30 ΠMaestra Π CF, Nome, Cognome ΠMaestra, Anno, Sezione Maestra = CF 12/9/13 2 Linguaggi Formali – Calcolo Relazionale {t| ∃ t1 ∈ INSEGNANTE, t2,t3∈ORARIO (t[CF, Nome, Cognome]=t1[CF, Nome, Cognome] ∧ t1[CF]=t2[Maestra]∧ (t2[Anno] <> t3[Anno] ∨ t2[Sezione] <> t3[Sezione]) ∧ t2[Maestra]= t3[Maestra] ∧ ¬ (∃ t4 ∈ ORARIO (t4[Maestra]=t1[Maestra]∧ t4[OraInizio]<10.30))) } Linguaggi Formali - DataLog Esprimere in datalog la seguente query: Estrarre le coppie di bambini che non sono nella stessa classe ma hanno almeno un insegnante in comune RISULTATO (B1, B2) – COMPOSIZIONE CLASSE (A1,S1,B1) COMPOSIZIONE CLASSE (A2,S2,B2), ORARIO (M, A1, S1, _,_,_,_) ORARIO (M, A2, S2, _,_,_,_) B1 <>B2 A1 <>A2 RISULTATO (B1, B2) – COMPOSIZIONE CLASSE (A1,S1,B1) COMPOSIZIONE CLASSE (A2,S2,B2), ORARIO (M, A1, S1, _,_,_,_) ORARIO (M, A2, S2, _,_,_,_) B1 <>B2 S1 <>S2 ? - Risultato(X, Y) 12/9/13 3 SQL: interrogazioni Per ogni classe, trovare la materia cui sono assegnate meno ore . CREATE VIEW NumeroOreClasse (Anno, Sezione, Materia,…

Preview

First page of the document.

First page: 28 11 13S