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 ~ informatica triennale > [CASTANO] Primo Compitino 05/06
Pages (11): « 1 2 3 [4] 5 6 7 8 » ... Last »   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
de_luna
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 441 (0.05 al dì)
Location: Prov. Milano
Corso: informatica
Anno: 3 (più o meno)
Time Online: 4 Days, 16:57:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

DISPOSITIVO-HW(Codice,Marca,Tipo)
MANUTENZIONE(Codice,Data,TipoGuasto,Costo,Addetto)

Si richiede di formulare in SQL quanto segue:
• trovare tutti i dati del dispositivo che ha subito la manutenzione meno costosa.

09-11-2005 10:49
Click Here to See the Profile for de_luna Click here to Send de_luna a Private Message Find more posts by de_luna Add de_luna to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Logan12584
Il più grande dei grandi

User info:
Registered: Nov 2003
Posts: 514 (0.06 al dì)
Location: The House of the Dead
Corso: I telecomunicazionisti conquisteranno il mondo
Anno: P(X>=2+1|X>2)
Time Online: 2 Days, 0:04:21 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

credo...


select disp.codice,disp.marca,disp.tipo
from man,disp
where disp.codice=man.codice and costo <= all (select costo
from manutenzione)
group by disp.codice,disp.marca,disp.tipo

__________________
Scompaio e di me solo fievoli ricordi affolleranno la mente delle genti conosciute,sarò fantasma e vagherò nelle terre di nessuno, finché l ultimo ricordo morrà insieme con il mio spirito...
Se non si è disposti a rivivere la propria vita, perché darsi la pena di viverla adesso ?
Youtube.it

09-11-2005 10:55
Click Here to See the Profile for Logan12584 Click here to Send Logan12584 a Private Message Find more posts by Logan12584 Add Logan12584 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Logan12584
Il più grande dei grandi

User info:
Registered: Nov 2003
Posts: 514 (0.06 al dì)
Location: The House of the Dead
Corso: I telecomunicazionisti conquisteranno il mondo
Anno: P(X>=2+1|X>2)
Time Online: 2 Days, 0:04:21 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Che dire...in bocca al lupo...

a todos :D





crepi

__________________
Scompaio e di me solo fievoli ricordi affolleranno la mente delle genti conosciute,sarò fantasma e vagherò nelle terre di nessuno, finché l ultimo ricordo morrà insieme con il mio spirito...
Se non si è disposti a rivivere la propria vita, perché darsi la pena di viverla adesso ?
Youtube.it

09-11-2005 11:04
Click Here to See the Profile for Logan12584 Click here to Send Logan12584 a Private Message Find more posts by Logan12584 Add Logan12584 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
de_luna
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 441 (0.05 al dì)
Location: Prov. Milano
Corso: informatica
Anno: 3 (più o meno)
Time Online: 4 Days, 16:57:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

io l'ho fatta così:
SELECT disp.codice, disp.marca, disp.tipo
FROM manutenzione NATURAL JOIN dispositivo hw ON CF
GROUP BY Codice, marca tipo
HAVING COUNT <=ALL SELECT costo
FROM MANUTENZIONE
Praticamente cambia che ho messo having e il join nella from, dici che va bene?

09-11-2005 11:07
Click Here to See the Profile for de_luna Click here to Send de_luna a Private Message Find more posts by de_luna Add de_luna to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Bombardini10
.consigliere.

User info:
Registered: Mar 2005
Posts: 136 (0.02 al dì)
Location:
Corso: informatica per le tlc
Anno:
Time Online: 5 Days, 15:52:38 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
Talking

ola logan guarda il messaggio privato che ti ho mandato.....

09-11-2005 11:20
Click Here to See the Profile for Bombardini10 Click here to Send Bombardini10 a Private Message Find more posts by Bombardini10 Add Bombardini10 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Logan12584
Il più grande dei grandi

User info:
Registered: Nov 2003
Posts: 514 (0.06 al dì)
Location: The House of the Dead
Corso: I telecomunicazionisti conquisteranno il mondo
Anno: P(X>=2+1|X>2)
Time Online: 2 Days, 0:04:21 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by de_luna
io l'ho fatta così:
SELECT disp.codice, disp.marca, disp.tipo
FROM manutenzione NATURAL JOIN dispositivo hw ON CF [forse intendevi codice :D ]
GROUP BY Codice, marca tipo
HAVING COUNT <=ALL SELECT costo
FROM MANUTENZIONE
Praticamente cambia che ho messo having e il join nella from, dici che va bene?


nell'having devi mettere count e che cosa conti quindi (*)

si va bene a parte quelle 2 cosette..ti consiglio di mettere le parentesi così la prof ci capisce di più :D :look:

__________________
Scompaio e di me solo fievoli ricordi affolleranno la mente delle genti conosciute,sarò fantasma e vagherò nelle terre di nessuno, finché l ultimo ricordo morrà insieme con il mio spirito...
Se non si è disposti a rivivere la propria vita, perché darsi la pena di viverla adesso ?
Youtube.it

09-11-2005 11:33
Click Here to See the Profile for Logan12584 Click here to Send Logan12584 a Private Message Find more posts by Logan12584 Add Logan12584 to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
de_luna
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 441 (0.05 al dì)
Location: Prov. Milano
Corso: informatica
Anno: 3 (più o meno)
Time Online: 4 Days, 16:57:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

si, nella fretta di copiare... comunque grazie mille, speriamo che vada bene!
A dopo

09-11-2005 11:54
Click Here to See the Profile for de_luna Click here to Send de_luna a Private Message Find more posts by de_luna Add de_luna to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
saradid
.grande:maestro.

User info:
Registered: Aug 2003
Posts: 753 (0.09 al dì)
Location:
Corso: Informatica Serale
Anno: 2
Time Online: 27 Days, 15:44:06: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Io l'ho fatta cosi' :

select * from dispositivo_hw where codice in (
select codice from manutenzione where costo in(
select min(costo) from manutenzione))

09-11-2005 12:04
Click Here to See the Profile for saradid Click Here to See the Blog of saradid Click here to Send saradid a Private Message Find more posts by saradid Add saradid to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
puntozip
.arcimaestro.

User info:
Registered: Jan 2003
Posts: 332 (0.04 al dì)
Location: milano
Corso: Ticom
Anno: 1
Time Online: 10 Days, 4:57:16 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by de_luna

HAVING COUNT <=ALL SELECT costo
FROM MANUTENZIONE
Praticamente cambia che ho messo having e il join nella from, dici che va bene?


Penso che non vada bene: il count ti conta il numero di record e non ha senso confrontarlo con il costo.

Due domande:
1) perchè usate il group by? Non si può evitare?
2) al posto di <= all avrei potuto usare = e min (costo) nella select interna? (non riesco a capire dove si possono o non possono usare le funzione aggregate...)

A poche ore dal compito ho ancora un sacco di dubbi!
:?

__________________
There are two ways of constructing a software design:
one way is to make it so simple that there are obviously no deficiencies;
the other way is to make it so complicated that there are no obvious deficiencies.
(C.A.R. Hoare)

09-11-2005 12:15
Click Here to See the Profile for puntozip Click here to Send puntozip a Private Message Find more posts by puntozip Add puntozip to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
de_luna
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 441 (0.05 al dì)
Location: Prov. Milano
Corso: informatica
Anno: 3 (più o meno)
Time Online: 4 Days, 16:57:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

SUl count ti do pienamente ragione, si può mettere HAVING costo <=........
???
e tolto il count si può togliere anche group by...
ma così mi sembra troppo facile...
l'usare i MIN e MAX nelle select interne Ferrara ieri ha detto che li sconsiglia, però si potrebbe usare con la select senza fare quella interna..
SELECT codice, marca, tipo, MIN (costo)
FROM Manutenzione NATURAL JOIN dispositivo HW ON codice

Non potrebbe andare?
Non sei l'unico ad avere i dubbi..

09-11-2005 12:26
Click Here to See the Profile for de_luna Click here to Send de_luna a Private Message Find more posts by de_luna Add de_luna to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
puntozip
.arcimaestro.

User info:
Registered: Jan 2003
Posts: 332 (0.04 al dì)
Location: milano
Corso: Ticom
Anno: 1
Time Online: 10 Days, 4:57:16 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by de_luna
SUl count ti do pienamente ragione, si può mettere HAVING costo <=........
???
e tolto il count si può togliere anche group by...
ma così mi sembra troppo facile...
l'usare i MIN e MAX nelle select interne Ferrara ieri ha detto che li sconsiglia, però si potrebbe usare con la select senza fare quella interna..
SELECT codice, marca, tipo, MIN (costo)
FROM Manutenzione NATURAL JOIN dispositivo HW ON codice


Non si possono usare attributi e funzioni aggregate nella clausola select senza group by...

__________________
There are two ways of constructing a software design:
one way is to make it so simple that there are obviously no deficiencies;
the other way is to make it so complicated that there are no obvious deficiencies.
(C.A.R. Hoare)

09-11-2005 12:37
Click Here to See the Profile for puntozip Click here to Send puntozip a Private Message Find more posts by puntozip Add puntozip to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
de_luna
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 441 (0.05 al dì)
Location: Prov. Milano
Corso: informatica
Anno: 3 (più o meno)
Time Online: 4 Days, 16:57:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Crepiiii
;-)

09-11-2005 12:41
Click Here to See the Profile for de_luna Click here to Send de_luna a Private Message Find more posts by de_luna Add de_luna to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
saradid
.grande:maestro.

User info:
Registered: Aug 2003
Posts: 753 (0.09 al dì)
Location:
Corso: Informatica Serale
Anno: 2
Time Online: 27 Days, 15:44:06: [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

scrivere cosi'

select * from dispositivo_hw where codice in (
select codice from manutenzione where costo in(
select min(costo) from manutenzione))


equivale a scrivere cosi'...

select disp.codice,disp.marca,disp.tipo
from manutenzione man,dispositivo disp
where disp.codice=man.codice and costo <= all (select costo
from manutenzione)
group by disp.codice,disp.marca,disp.tipo

09-11-2005 12:42
Click Here to See the Profile for saradid Click Here to See the Blog of saradid Click here to Send saradid a Private Message Find more posts by saradid Add saradid to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
de_luna
.arcimaestro.

User info:
Registered: Oct 2003
Posts: 441 (0.05 al dì)
Location: Prov. Milano
Corso: informatica
Anno: 3 (più o meno)
Time Online: 4 Days, 16:57:44 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by puntozip
Non si possono usare attributi e funzioni aggregate nella clausola select senza group by...


ops...
QUindi aggiungiamo group by, ma a questo punto (scusa ma faccio fatica a capirlo) group by Costo
o group by id, nome cognome?

09-11-2005 12:42
Click Here to See the Profile for de_luna Click here to Send de_luna a Private Message Find more posts by de_luna Add de_luna to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
puntozip
.arcimaestro.

User info:
Registered: Jan 2003
Posts: 332 (0.04 al dì)
Location: milano
Corso: Ticom
Anno: 1
Time Online: 10 Days, 4:57:16 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Io la vedo così:
il group by lo uso solo per eseguire funzioni su "sottoinsiemi" di record, ad esempio se avessi avuto una categoria di dispositivo e mi interessava il costo totale della categoria che fosse il minimo tra tutte le categorie (allora avrei raggruppato per categoria).
Ma nel caso in esame vogliamo considerare tutti i dispositivi che sono singole tuple e hanno un attributo (costo) che posso direttamente confrontare con il minimo (ricavato dalla select interna), infatti il confronto lo faccio nella where e non nell'having (che riguarda i valori dei gruppi).

Spero di non crearti ulteriore confusione (prendi quel che scrivo con beneficio d'inventario...)

__________________
There are two ways of constructing a software design:
one way is to make it so simple that there are obviously no deficiencies;
the other way is to make it so complicated that there are no obvious deficiencies.
(C.A.R. Hoare)

09-11-2005 13:15
Click Here to See the Profile for puntozip Click here to Send puntozip a Private Message Find more posts by puntozip Add puntozip to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 07:51.    Post New Thread    Post A Reply
Pages (11): « 1 2 3 [4] 5 6 7 8 » ... Last »   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.072 seconds (78.21% PHP - 21.79% MySQL) con 24 query.