![]() |
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)
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#;
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ì!!!!!!!! ![]()
__________________
«And if you ever smell christian blood up in the mountains, then get your axe and chop them down!»
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!
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!»
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!![]()
Grazie mimaaaaaaaaaaaa!!!!!!!!!!!![]()
potete sempre testare le query con mySql...
__________________
Il DSY su Facebook!!!
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!»
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!!!
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...
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!»
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!»
![]()
Qualcuno vuole la traduzione di quel che c'è scritto nel link di Ripe?

__________________
Il DSY su Facebook!!!
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
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
| 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.