|
|
|
|
 |
|  |
 |
Alis |
| Basi di dati:soluzioni?? |
09-02-2003 20:23 |
|
 |
Alis |
.grande:maestro.

Registered: Jun 2002
Posts: 862 (0.10 al dì)
Location: Corsico
Corso:
Anno:
Time Online: 10 Days, 16:32:12 [...]
Status: Offline
Edit | Report | IP: Logged |
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#;
|
|
09-02-2003 20:23 |
|
|
|  |
 |
ripe |
| Dai, qualcuno che risponda!!! :(
... |
10-02-2003 11:40 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.09 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
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!»
|
|
10-02-2003 11:40 |
|
|
|  |
 |
mimasuper |
| Riguardo all'esame del 13-01-03 il C dell'esercizi ... |
10-02-2003 12:29 |
|
 |
mimasuper |
.consigliere.

Registered: Sep 2002
Posts: 146 (0.02 al dì)
Location: vic. Milano
Corso: com.dig.
Anno: III anno
Time Online: 2 Days, 13:24:04: [...]
Status: Offline
Edit | Report | IP: Logged |
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!
|
|
10-02-2003 12:29 |
|
|
|  |
 |
ripe |
| Grazie, proveremo a rivederlo un attimo! ... |
10-02-2003 12:42 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.09 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
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!»
|
|
10-02-2003 12:42 |
|
|
|  |
 |
imation |
| [QUOTE][i]Originally posted by mimasuper [/i]
... |
10-02-2003 13:32 |
|
 |
imation |
.illuminato.

Registered: May 2002
Posts: 158 (0.02 al dì)
Location:
Corso: Comunicazione Digitale
Anno: 2
Time Online: 3 Days, 1:19:31 [...]
Status: Offline
Edit | Report | IP: Logged |
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...
Last edited by imation on 10-02-2003 at 13:37
|
|
10-02-2003 13:32 |
|
|
|  |
 |
Alis |
| Grazie mimaaaaaaaaaaaa!!!!!!!!!!!:D ... |
10-02-2003 18:54 |
|
 |
Alis |
.grande:maestro.

Registered: Jun 2002
Posts: 862 (0.10 al dì)
Location: Corsico
Corso:
Anno:
Time Online: 10 Days, 16:32:12 [...]
Status: Offline
Edit | Report | IP: Logged |
Grazie mimaaaaaaaaaaaa!!!!!!!!!!!
|
|
10-02-2003 18:54 |
|
|
|  |
 |
Lunik |
| potete sempre testare le query con mySql... ... |
10-02-2003 18:59 |
|
 |
Lunik |
dsy core staff

Registered: Mar 2002
Posts: 22362 (2.56 al dì)
Location: Milano
Corso: ComDig
Anno: Dott.ssa
Time Online: 93 Days, 0:52:10 [...]
Status: Offline
Edit | Report | IP: Logged |
potete sempre testare le query con mySql...
__________________
Il DSY su Facebook!!!
|
|
10-02-2003 18:59 |
|
|
|  |
 |
ripe |
| Con Access mi vanno, ma lei le considera sbagliate ... |
10-02-2003 19:31 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.09 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
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!»
|
|
10-02-2003 19:31 |
|
|
|  |
 |
Lunik |
| Lei chi?
... |
10-02-2003 19:34 |
|
 |
Lunik |
dsy core staff

Registered: Mar 2002
Posts: 22362 (2.56 al dì)
Location: Milano
Corso: ComDig
Anno: Dott.ssa
Time Online: 93 Days, 0:52:10 [...]
Status: Offline
Edit | Report | IP: Logged |
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!!!
|
|
10-02-2003 19:34 |
|
|
|  |
 |
imation |
| SELECT CodFornitore, COUNT(CodComputer)
... |
11-02-2003 01:08 |
|
 |
imation |
.illuminato.

Registered: May 2002
Posts: 158 (0.02 al dì)
Location:
Corso: Comunicazione Digitale
Anno: 2
Time Online: 3 Days, 1:19:31 [...]
Status: Offline
Edit | Report | IP: Logged |
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...
|
|
11-02-2003 01:08 |
|
|
|  |
 |
ripe |
| Il problema è che non ho mai visto questo FETCH a ... |
11-02-2003 07:27 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.09 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
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!»
|
|
11-02-2003 07:27 |
|
|
|  |
 |
ripe |
| Molto interessante questo link:
... |
11-02-2003 07:32 |
|
 |
ripe |
- up in the mountains -

Registered: Jun 2002
Posts: 9469 (1.09 al dì)
Location: Cinisellooo
Corso: TICO TICO
Anno: Primo
Time Online: 61 Days, 2:33:39 [...]
Status: Offline
Edit | Report | IP: Logged |
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!»
|
|
11-02-2003 07:32 |
|
|
|  |
 |
Lunik |
|
 |
Lunik |
dsy core staff

Registered: Mar 2002
Posts: 22362 (2.56 al dì)
Location: Milano
Corso: ComDig
Anno: Dott.ssa
Time Online: 93 Days, 0:52:10 [...]
Status: Offline
Edit | Report | IP: Logged |

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

__________________
Il DSY su Facebook!!!
|
|
11-02-2003 09:57 |
|
|
|  |
 |
Vale |
| io per il punto (c) del primo esercizio del 13/01 ... |
12-02-2003 13:16 |
|
 |
Vale |
.illuminato.
Registered: Jul 2002
Posts: 230 (0.03 al dì)
Location:
Corso:
Anno:
Time Online: 3 Days, 19:48:50 [...]
Status: Offline
Edit | Report | IP: Logged |
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
|
|
12-02-2003 13:16 |
|
|
|  |
 |
imation |
| [QUOTE][i]Originally posted by Vale [/i]
... |
12-02-2003 14:52 |
|
 |
imation |
.illuminato.

Registered: May 2002
Posts: 158 (0.02 al dì)
Location:
Corso: Comunicazione Digitale
Anno: 2
Time Online: 3 Days, 1:19:31 [...]
Status: Offline
Edit | Report | IP: Logged |
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...
|
|
12-02-2003 14:52 |
|
|
|  |
 |
| All times are GMT. The time now is 03:49. |
|
|
 |
|
 |
|
|
|  |
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
|
|
|
|
|
|