.dsy:it. Pages (3): [1] 2 3 »
Show 150 posts per page

.dsy:it. (http://www.dsy.it/forum/)
- Basi di dati ~ comunicazione digitale (http://www.dsy.it/forum/forumdisplay.php?forumid=108)
-- Basi di dati:soluzioni?? (http://www.dsy.it/forum/showthread.php?threadid=2685)


Posted by Alis on 09-02-2003 20:23:

Question Basi di dati:soluzioni??

Abbiamo fatto degli esercizi, ma non siamo sicuri dei risultati, ci potete dire se sono giusti?

Grazie!!!!!!!!!!!!!

Esame 13/01/03:

Esercizio 1:
A) SELECT DISTINCT IndirizzoFornitore
FROM Computer, Installazione
WHERE Computer.CodComputer=Installazione.CodComputer
AND descrizioneSoftware="database";

B) SELECT Marca, Modello, COUNT(CodComputer)
FROM Computer
GROUP BY Marca, Modello;

C) SELECT CodFornitore, MAX(COUNT(CodComputer))
FROM Computer
GROUP BY CodFornitore;

Esercizio 3:
CREATE TABLE R1(K Integer not null, A Integer)
PRIMARY KEY (K);
GRANT SELECT ON R1 TO Rossi;

CREATE TABLE R2(K Integer not null, B Integer)
PRIMARY KEY (K);
GRANT SELECT ON R2 TO Rossi;

INSERT INTO R1(K, A)
SELECT K, A
FROM R;

INSERT INTO R2(K, B)
SELECT K, B
FROM R;

DROP TABLE R;

CREATE VIEW R(K, A, B) AS
SELECT K, A, B
FROM R1, R2
WHERE R1.K=R2.K;


Esame 11/6/99:

Esercizio 1:
SELECT MAX(Prezzo), MIN(Prezzo), Nome
FROM Vendite, Auto, Venditori
WHERE Venditori.Vcod=Vendite.Vcod AND Auto.Acod=Vendite.Acod
AND Età <30 AND Marca="Toyota" AND Modello="Carina"
GROUP BY Nome;


Esame 20/6/02:

Esercizio 1:
B) SELECT Autore#, MIN(COUNT(Libro#))
FROM Libri, Prestiti
WHERE Libri.Libro#=Prestiti.Libro#
GRUOP BY Autore#;

C) DELETE FROM Libri
WHERE Argomento-Principale="Teoria degli Algoritmi"
Libro IN (SELECT Libro FROM Prestiti
WHERE Nome-Utente="Rossi");


Esame 2/9/02:

Esercizio 1: A) SELECT DISTINCT IndirizzoFornitore
FROM Computer, Installazione
WHERE Computer.CodComputer=
Installazione.CodComputer AND
dataInstallazione < #1/1/95#;


Posted by ripe on 10-02-2003 11:40:

Angry

Dai, qualcuno che risponda!!! :(

Ne mettiamo su un altro, del 20/06/2002, il numero 3:

a)

Tom: GRANT select, insert ON R TO Alice, Sam WITH GRANT OPTION;
Tom: GRANT delete ON R TO Alice;
Sam: GRANT select ON R TO Ann WITH GRANT OPTION;
Ann: GRANT select ON R TO Matt WITH GRANT OPTION;
Alice: GRANT select, insert ON R TO Matt, Ann WITH GRANT OPTION;
Matt: GRANT insert, select ON R TO Helen;
Tom: REVOKE select, insert, delete ON R FROM Alice;

b) Dopo il comando di revoca, Matt, Ann ed Helen possono eseguire solamente operazioni di SELECT.

Per favore, prima di giovedì!!!!!!!! :cry:

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by mimasuper on 10-02-2003 12:29:

Riguardo all'esame del 13-01-03 il C dell'esercizio 1 è sbagliato. Ne sono sicura xchè anch'io l'ho fatto così all'esame e me l'ha segnato. Non so sinceramente come si faccia, ma so che non puoi fare MAX(COUNT(CodComputer). Per il resto gli altri mi sembrano giusti, xchè anch'io li ho fatti così. In bocca al lupo!:)


Posted by ripe on 10-02-2003 12:42:

Grazie, proveremo a rivederlo un attimo!

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by imation on 10-02-2003 13:32:

Originally posted by mimasuper
Riguardo all'esame del 13-01-03 il C dell'esercizio 1 è sbagliato. Ne sono sicura xchè anch'io l'ho fatto così all'esame e me l'ha segnato. Non so sinceramente come si faccia, ma so che non puoi fare MAX(COUNT(CodComputer). Per il resto gli altri mi sembrano giusti, xchè anch'io li ho fatti così. In bocca al lupo!:)


anch'io l'avevo pensato così ma ho visto che nn si può fare (lo stesso vale per Esame 20/6/02: Esercizio 1: B) SELECT Autore#, MIN(COUNT(Libro#)))... mi sono scervellato ma nn ho trovato soluzione...

se avete qualche idea mi dareste una mano...


Posted by Alis on 10-02-2003 18:54:

Grazie mimaaaaaaaaaaaa!!!!!!!!!!!:D


Posted by Lunik on 10-02-2003 18:59:

potete sempre testare le query con mySql...

__________________
Il DSY su Facebook!!!


Posted by ripe on 10-02-2003 19:31:

Con Access mi vanno, ma lei le considera sbagliate!

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by Lunik on 10-02-2003 19:34:

Lei chi?
strano..Access.....con non so che pulsantino vedevi il codice SQL...che è un po' da modificare xè non è quello standard...

__________________
Il DSY su Facebook!!!


Posted by imation on 11-02-2003 01:08:

SELECT CodFornitore, COUNT(CodComputer)
FROM Computer
GROUP BY CodFornitore
ORDER BY COUNT(CodComputer) DESC
FETCH FIRST ROW ONLY;

...questo comando dovrebbe prendere solo la prima tupla del risultato, quindi quella con il maggior numero di computer...


Posted by ripe on 11-02-2003 07:27:

Il problema è che non ho mai visto questo FETCH a lezione, pensa che non ha neanche spiegato TOP n, che permette di scegliere le prime n righe!

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by ripe on 11-02-2003 07:32:

Molto interessante questo link:

Clicca qui per le funzioni di gruppo a due livelli

Leggete soprattutto l'ultima parte in fondo!!!

__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»


Posted by Lunik on 11-02-2003 09:57:

:D
Qualcuno vuole la traduzione di quel che c'è scritto nel link di Ripe?

:asd:

__________________
Il DSY su Facebook!!!


Posted by Vale on 12-02-2003 13:16:

io per il punto (c) del primo esercizio del 13/01 ho fatto così

select distinct c.codFornitore from
computer c,
(select codFornitore, count(*) as b from computer group by codFornitore) t

WHERE
b=(select max(a) from (select count(*) as a from computer group by codfornitore) h)
and c.codfornitore=t.codfornitore

che ne pensate?


X Ripe

l'esercizio del20/06/02 è corretto secondo me puoi essere più preciso dicendo che Matt e Ann hanno diritti di Select con grant option, mentre helen solo select


Posted by imation on 12-02-2003 14:52:

Originally posted by Vale
WHERE
b=(select max(a) from (select count(*) as a from computer group by codfornitore) h)
and c.codfornitore=t.codfornitore



qui penso ci sia un errore, xchè nn si può impostare condizioni sul count(funzione di gruppo) con il where... dovresti farlo con un having...


All times are GMT. The time now is 10:51. Pages (3): [1] 2 3 »
Show all 42 posts from this thread on one page

Powered by: vBulletin Version 2.3.1
Copyright © Jelsoft Enterprises Limited 2000 - 2002.