Dsy Network www | forum | my | didattica | howto | wiki | el goog | stats | blog | dona | rappresentanti
Homepage
 Register   Calendar   Members  Faq   Search  Logout 
.dsy:it. : Powered by vBulletin version 2.3.1 .dsy:it. > Didattica > Corsi A - F > Basi di dati ~ comunicazione digitale > [FAQ] - Esercizi in preparazione del compitino! Thread Rating: 1 votes, 5.00 average.
Pages (5): [1] 2 3 4 5 »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Flavia
Regina degli avatar

User info:
Registered: Sep 2002
Posts: 3228 (0.39 al dì)
Location: Bergamo
Corso: TI.COM
Anno: Finito! :D
Time Online: 25 Days, 9:12:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Esercizi in preparazione del compitino!

Grazie al mio fidatissimo collaboratore Eletabboz (..ma si scrive così poi???), ho trovato un po'di esercizi in preparazione per il compitino di basi di dati del 19 Dicembre. Sono tratti da appelli passati della Bertino, quindi ritengo siano molto molto utili per avere un'idea precisa del tipo di esamino che ci aseptta!
Li trovate a questo link:
http://www.dsy.it/forum/forumdisplay.php?s=&forumid=41

dal momento che molti di questi non hanno le soluzioni, propongo di usare questo thread per pubblicare le possibili soluzioni di tali esercizi, giusto così per vedere se riusciamo a farli correttamente. Non vorrei esaltarmi perchè magari penso di averli fatti tutti giusti, e magari sono completamente cannati! Preferisco sbagliarli ma almeno sapere dove e come sbaglio, grazie appunto a un confronto, di conferma o di smentita, riguardo le soluzioni!
Posterò le mie soluzioni il più presto possibile!
Grazie!

14-12-2003 12:45
Click Here to See the Profile for Flavia Click Here to See the Blog of Flavia Click here to Send Flavia a Private Message Find more posts by Flavia Add Flavia to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
ElEtAbbOZ
.grande:maestro.

User info:
Registered: Nov 2002
Posts: 1637 (0.20 al dì)
Location: Veduggio -MI-
Corso: ComDig
Anno: 3
Time Online: 27 Days, 23:56:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Re: Esercizi in preparazione del compitino!

Off-Topic:
Originally posted by Flavia
Grazie al mio fidatissimo collaboratore Eletabboz (..ma si scrive così poi???)
:schoked: :schoked: :grr: :sbonk: :sbonk:

__________________
Non cliccare!
MSN: eletabboz@hotmail.com

14-12-2003 18:01
Click Here to See the Profile for ElEtAbbOZ Click Here to See the Blog of ElEtAbbOZ Click here to Send ElEtAbbOZ a Private Message Find more posts by ElEtAbbOZ Add ElEtAbbOZ to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
morf
e.Vanishing guy

User info:
Registered: Nov 2002
Posts: 1856 (0.22 al dì)
Location: Treviglio (BG)
Corso: TICO
Anno: primo
Time Online: 5 Days, 11:35:09: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

:approved:

__________________
mail, msn and steam account: morf@email.it
my blog: http://melien.blogspot.com
my shots: http://mr-anf.deviantart.com


" ... fear is how I fall ... "

14-12-2003 18:20
Click Here to See the Profile for morf Click here to Send morf a Private Message Visit morf's homepage! Find more posts by morf Add morf to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Barone
non cambio mai avatar

User info:
Registered: Dec 2002
Posts: 4943 (0.60 al dì)
Location:
Corso: Done.
Anno:
Time Online: 36 Days, 5:19:15 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ho provato a fare il primo es della prova del 13/01/2003


a) Select IndirizzoFornitore
From Computer,Installazione
Where Computer.Codcomputer=Installazione.CodComputer
AND DescrizioneSoftware='database'

b) Select Count(CodComputer)
From Computer,Installazione
Where Computer.Codcomputer=Installazione.CodComputer
Groupby marca,modello

c) Select CodFornitore,Count (CodFornitore)AS numeroforniture
From Computer,Installazione
Where Computer.Codcomputer=Installazione.CodComputer
Orderby numeroforniture DESC

c2)Ho provato anche in un altra versione..ditemi se è corretta...(anche se ho molti dubbi che lo sia)

Select CodFornitore
From Computer,Installazione
Where Computer.Codcomputer=Installazione.CodComputer
Groupby codfornitore
Having Max(Count(Codfornitore))

Che dite
:? :?

15-12-2003 15:56
Click Here to See the Profile for Barone Click Here to See the Blog of Barone Click here to Send Barone a Private Message Find more posts by Barone Add Barone to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Lunik
dsy core staff

User info:
Registered: Mar 2002
Posts: 22362 (2.63 al dì)
Location: Milano
Corso: ComDig
Anno: Dott.ssa
Time Online: 93 Days, 0:52:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ups se avete pazienza vedo di postare un po' di miei file :asd: :D :asd:

__________________
Il DSY su Facebook!!!

Last edited by Lunik on 15-12-2003 at 18:12

15-12-2003 16:00
Click Here to See the Profile for Lunik Click Here to See the Blog of Lunik Click here to Send Lunik a Private Message Visit Lunik's homepage! Find more posts by Lunik Add Lunik to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Lunik
dsy core staff

User info:
Registered: Mar 2002
Posts: 22362 (2.63 al dì)
Location: Milano
Corso: ComDig
Anno: Dott.ssa
Time Online: 93 Days, 0:52:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Firulì firulà

:D :D

__________________
Il DSY su Facebook!!!

15-12-2003 16:15
Click Here to See the Profile for Lunik Click Here to See the Blog of Lunik Click here to Send Lunik a Private Message Visit Lunik's homepage! Find more posts by Lunik Add Lunik to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
luna
.grande:maestro.

User info:
Registered: Apr 2003
Posts: 4565 (0.56 al dì)
Location: Rozzano
Corso:
Anno: Ormai finito!
Time Online: 102 Days, 14:49:55 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

grande flavy!!sei mitica!!:approved:

15-12-2003 18:08
Click Here to See the Profile for luna Click Here to See the Blog of luna Click here to Send luna a Private Message Find more posts by luna Add luna to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
futurbaggio
U Frikkettone

User info:
Registered: Feb 2003
Posts: 774 (0.09 al dì)
Location: Foggia
Corso: TIC
Anno: 1° Magistrale
Time Online: 13 Days, 16:44:00: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ciao,
allora, io ho fatto diversamente alcune cose

a) Select DISTINCT IndirizzoFornitore
From Computer,Installazione
Where Computer.Codcomputer=Installazione.CodComputer
AND DescrizioneSoftware='database'

Ho fatto così perchè veniva specificato che un stesso fornitore aveva sempre lo stesso indirizzo, quindi è inutile avere tuple ripetute. Piccola finezza, ma forse era un trabocchetto dell'esercizio.

b) Select Count(CodComputer), marca, modello
From Computer
Groupby marca,modello

Qui come sotto hai fatto una JOIN su Installazione che è inutile. Qui nn si richiede di trovare i computer con dei software installati, ma solo i computer con modello e marca (attributi della tabella Computer).

c) SELECT CodFornitore FROM Computer
GROUP BY CodFornitore
HAVING Count(CodFornitore) > ALL (SELECT Count(CodFornitore) FROM Computer GROUP BY CodFornitore)

le tue due versioni mi sembrano sbagliate, non voglio essere cattivo, ma lo sono parecchio :twisted:

Per altri dubbi ci sono :twisted:

Roberto

__________________
E lo sceriffo americano non lo sa / ma quando parla ride tutta la città / vile fellone vieni a singolar tenzone / unza unza umpappà troppe truppe mariscià.
Non ci voleva l'eruzione della lava / e due piccioni si contendono la fava / sposa bagnata, bambina svergognata / la questione è delicata / come bolle la patata.
Basta! E' finita la festa
[L'ovile delle vanità, Folkabbestia]

15-12-2003 18:47
Click Here to See the Profile for futurbaggio Click Here to See the Blog of futurbaggio Click here to Send futurbaggio a Private Message Visit futurbaggio's homepage! Find more posts by futurbaggio Add futurbaggio to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Barone
non cambio mai avatar

User info:
Registered: Dec 2002
Posts: 4943 (0.60 al dì)
Location:
Corso: Done.
Anno:
Time Online: 36 Days, 5:19:15 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Immaginavo che fossero sbagliati..li ho messi perchè speravo qlc mi chiarisse cosa non andava...ora me li riguardo..
Ho un dubbio sul join..in classe mi sembra di aver sentito che basta elencare più relazioni dopo il from per avere un join..sono di un altro pianeta o c'è qlc di vero?
Grazie Roberto

Last edited by Barone on 15-12-2003 at 19:49

15-12-2003 19:43
Click Here to See the Profile for Barone Click Here to See the Blog of Barone Click here to Send Barone a Private Message Find more posts by Barone Add Barone to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Glucks
.illuminato.

User info:
Registered: May 2003
Posts: 220 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 1 Day, 15:43:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

In particolare a me ACCESS e SQLITE mi danno errore quando si innestano funzioni di gruppo.

PER ESEMPIO non posso fare il MAX di una COUNT

MAX(COUNT(*));

Confermate?

Cmq grazie a Lunik perchè senza soluzioni eravamo nei casini... ora finalmente si capisce qualcosa di più... GRAZIE !!

15-12-2003 19:50
Click Here to See the Profile for Glucks Click here to Send Glucks a Private Message Find more posts by Glucks Add Glucks to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Flavia
Regina degli avatar

User info:
Registered: Sep 2002
Posts: 3228 (0.39 al dì)
Location: Bergamo
Corso: TI.COM
Anno: Finito! :D
Time Online: 25 Days, 9:12:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Cofermo tutto futurbaggio!!!
Yeahhhhhh!!!!

15-12-2003 20:29
Click Here to See the Profile for Flavia Click Here to See the Blog of Flavia Click here to Send Flavia a Private Message Find more posts by Flavia Add Flavia to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Flavia
Regina degli avatar

User info:
Registered: Sep 2002
Posts: 3228 (0.39 al dì)
Location: Bergamo
Corso: TI.COM
Anno: Finito! :D
Time Online: 25 Days, 9:12:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ecco le mie soluzioni..per ora!!!
Vi prego chiaritemi i dubbi che ho inserito all'interno della soluzioni! Soprattutto quelli sui diagrammi E-R!!!

SOLUZIONI ESERCIZI PROVA D’ESAME 02-09-2003

ESERCIZIO 1

a)Select indirizzo_fornitore from computer, installazione
where computer.codcomputer=installazioni.codcomputer
and data_installazione > ‘1995-01-01’;
Si usa questa notazione per le date???

b)Select count (codcomputer),marca, modello from computer
group by marca,modello

c)select codfornitore from computer
group by codfornitore
having count (*) >= all (select count (*) from computer group by codfornitore)

ESERCIZIO 2






Marca
Modello
Codfornitore
Indirizzo fornitore
Codcomputer

Ma se cod computer presente in entrambe le relazioni, lo metto comunque in entrambe no? Quindi codcomputer va sia in computer che in installazione?E come faccio a far capire che codcomputer nella relazione Computer è chiave primaria, mentre in installazione è una chiave esterna?

3)Create table r1 (k integre primari key, a integre)
create table r2 (k integre primari key, a integre)
insert into r1 select k,a from r
insert into r2 k,b from r
drop table r
create view r as select k,a,b from r1,r2 where r1.k=r2.k

A me sembra che la Bertino a lezione abbia scritto “create view r as select k,k,a,b from r1,r2 where r1.k=r2.k)”. A me pare strano!Quale è la soluzione giusta?

15-12-2003 20:36
Click Here to See the Profile for Flavia Click Here to See the Blog of Flavia Click here to Send Flavia a Private Message Find more posts by Flavia Add Flavia to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Flavia
Regina degli avatar

User info:
Registered: Sep 2002
Posts: 3228 (0.39 al dì)
Location: Bergamo
Corso: TI.COM
Anno: Finito! :D
Time Online: 25 Days, 9:12:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

SOLUZIONI ESERCIZI PROVA D’ESAME 01-07-2003-

ESERCIZIO 1

i)p(cognome, nome)(s(nomecorso=’so’ Ù votazione ‘27’)(esami)´ studenti)

ii)dolete from esami
where n_matricola in (select n_matricola from esami studenti
where esami.n_matricola = studenti.n_matricola and nome=’maria’ and cognome=’rossi’);

iii)select n_matricola from studenti
where not exists (select n_matricola from studenti, esami
where studenti.n_matricola= esami.n_matricola and anno=’2002’);

4)select cognome form esami
where studenti.n_matricola = esmai.n_matricola
and intervallo????
Group by n_matricola
Having count (*) all (select….)
Come faccioa esprimere gli intervalli???????????????

ESERCIZIO 2
Create table studenti (N-matricola decimal (7) primari key
Cognome char (20) not null
Nome char (20) not null)

Create table esami (corso# decimal (7)


Primari key (N-matricola, corso#)
Foreign key N-matricola references studenti on dolete cascade

Come faccio ad esprimere che un esame non può essere cancellato se lo studente a cui l’esame si riferisce è presente nella base di dati?????

15-12-2003 20:37
Click Here to See the Profile for Flavia Click Here to See the Blog of Flavia Click here to Send Flavia a Private Message Find more posts by Flavia Add Flavia to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Flavia
Regina degli avatar

User info:
Registered: Sep 2002
Posts: 3228 (0.39 al dì)
Location: Bergamo
Corso: TI.COM
Anno: Finito! :D
Time Online: 25 Days, 9:12:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

ESERCIZIO FATTO IN CLASSE

Abbiam la relazione
Prodotti (P#, nome)
PRODUTTORI (pr#,nomeproduttori, PIVA)
FORNITURE (P#,pr#)

Formulare interrogazione sql che determini ogni prodotto restituendone il codice per cui esiste un prodotto con lo stesso nome

Select p# from prodotti x
Where exists (select * from prodotti y where y.p# = x.p# and y.nome = x.nome);

Io l’avevo fatto così: va bene lo stesso?
Select x.p# from prodotti x
Where exists (select y.p# from prodotti y where y.p# = x.p# and y.nome = x.nome);

15-12-2003 20:37
Click Here to See the Profile for Flavia Click Here to See the Blog of Flavia Click here to Send Flavia a Private Message Find more posts by Flavia Add Flavia to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Flavia
Regina degli avatar

User info:
Registered: Sep 2002
Posts: 3228 (0.39 al dì)
Location: Bergamo
Corso: TI.COM
Anno: Finito! :D
Time Online: 25 Days, 9:12:10 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

SOLUZIONI ESERCIZI PROVA D’ESAME 16-06-2003

ESERCIZIO 1

i)P(cognomi_revisori) (s(specializzazione=’db’ (revisori)) - P(cognomi_revisori) (s(specializzazione=’db’ (revisori) ´ assegnamenti)

ii)select prog# from progetti
where datefine > ‘2003-04-14’;
E’ giusto scrivere le date così???

iii)Select x.prog#, x.budget from progetti x
where x.budget >= all (select y.budget from progetti y where x.budget <> y.budget)

iiii) Select rev# from assegnamenti
group by rev# havnign count (*) >=all (select count(*) from assegnamenti group by rev#

ESERCIZIO 2
Create table progetti (prog# decimal (4) primary key
….
…..
constraint budget-constraint check budget >=20.000 and budget <=100.000);

Create table revistori (….
…..
…..
specializzazione char (20) check (specializzazione in (‘bd’,’sicurezza’,’sd,’sm’,’so’)
;

Create table assegnamenti (prog# decimal(4)
Rev# decimal (4)
Dassegnamento date
Primary key (prog#, rev#)
Foreign key (prog# references progetti on delete cascade)
Foreign key (rev#) references revidori on delete restrinct)

ESERCIZIO 3






Prog#
Nome prog
Data inizio
Data fine
budget

Dubbio megaamletico!!!Dal momento che prog# e rev# sono chiavi esterne per assegnamenti, devo inserirle anche in “assegnamenti”??Cioè. prog# e rev# sono gli attributi dell’associazione ?Come faccio a far capire che ci si riferisce proprio al prog# di progetti e al rev# di revisori?













Devo aggiungere un nuovo attributo a revisori o basta così??

ESERCIZIO 4
Create view v as
Select rev#, nome, cognome, prog# from revisori, assegnamenti where revisori.rev#= assegnamenti.rev#

15-12-2003 20:38
Click Here to See the Profile for Flavia Click Here to See the Blog of Flavia Click here to Send Flavia a Private Message Find more posts by Flavia Add Flavia to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 00:22.    Post New Thread    Post A Reply
Pages (5): [1] 2 3 4 5 »   Last Thread   Next Thread
Show Printable Version | Email this Page | Subscribe to this Thread | Add to Bookmarks

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is ON
 

Powered by: vBulletin v2.3.1 - Copyright ©2000 - 2002, Jelsoft Enterprises Limited
Mantained by dsy crew (email) | Collabora con noi | Segnalaci un bug | Archive | Regolamento | Licenze | Thanks | Syndacate
Pagina generata in 0.109 seconds (68.76% PHP - 31.24% MySQL) con 23 query.