← Back
ExamFull examExam paper onlyItalian

06 03 15s

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

Basi di DatiFull exam

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

Basi di Dati Prof. L. Tanca e F. A. Schreiber APPELLO DEL 6 MARZO 2015 Tempo: 2h30m Si consideri il seguente schema di base di dati, che vuole memorizzare alcune informazioni relative a Twitter. TWEET (TweetId, Testo, Utente, DataPubblicazione, NazionePubblicazione, Retweet) UTENTE (IdUtente, Nome, Nazione, DataIscrizione) SEGUE (Utente, UtenteSeguito, DataInizio) PREFERITO (Utente, Tweet) Gli utenti possono pubblicare tweet, eventualmente facendo il retweet di un tweet già esistente (cioè pubblicandolo nuovamente). Se un tweet è il retweet di un tweet già esistente, allora l’attributo Retweet della tabella TWEET contiene l’id del tweet originale; se il tweet non è un retweet l’attributo Retweet vale NULL. Gli identificatori di tweet e utenti sono valori interi. A. LINGUAGGI FORMALI (6 punti) Esprimere in algebra relazionale (ottimizzata) e calcolo relazionale la seguente interrogazione: Trovare gli id e i nomi di tutti gli utenti francesi che hanno indicato almeno due diversi tweet come preferiti e che sono seguiti da utenti italiani. (4 punti) Algebra relazionale IdUtente=Utente Utente=IdUtente T Tweet PREFERITO PREFERITO Tweet≠T UTENTE Nazione=’Francia’ IdUtente, Nome IdUtente, Nome Utente IdUtente UTENTE Nazione=’Italia’ SEGUE UtenteSeguito IdUtente=UtenteSeguito IdUtente, Nome Utente, UtenteSeguito Calcolo relazionale {t | (∃t1∈ PREFERITO, ∃t2∈ PREFERITO, ∃t3∈ UTENTE, ∃t4∈UTENTE, ∃t5∈SEGUE (t[IdUtente, Nome]=t3[IdUtente, Nome] ∧ t1[Utente]=t2[Utente] ∧ t1[Utente]=t3[IdUtente] ∧ t4[IdUtente]=t5[Utente] ∧ t3[IdUtente]=t5[UtenteSeguito] ∧ t1[Tweet]≠t2[Tweet] ∧ t3[Nazione]=’Francia’ ∧ t4[Nazione]=’Italia’)} Esprimere in Datalog la seguente interrogazione: Trovare gli id degli utenti iscritti a partire dal 01/06/2014 che non hanno mai pubblicato retweet di tweet…

Preview

First page of the document.

First page: 06 03 15s