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 > [SQL] Help query
Pages (2): « 1 [2]   Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
mark
.grande:maestro.

User info:
Registered: Oct 2003
Posts: 783 (0.10 al dì)
Location:
Corso: F49
Anno: finito!
Time Online: 8 Days, 18:34:33 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Approfitto ancora un pò della tua disponibilità.
Ti sembra giusta questa traduzione dello schema relazionale dato per la query in concettuale ?

Grazie

Attachment: immagine.gif
This has been downloaded 8 time(s).

__________________
Non ti perdere di coraggio se ti tocca lavorare molto e raccogliere poco.....

22-02-2007 14:54
Click Here to See the Profile for mark Click here to Send mark a Private Message Find more posts by mark Add mark to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
zonker
.illuminato.

User info:
Registered: Mar 2003
Posts: 200 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 2 Days, 6:24:53 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Direi proprio di sì.

22-02-2007 15:24
Click Here to See the Profile for zonker Click here to Send zonker a Private Message Find more posts by zonker Add zonker to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mostrielo
boolean

User info:
Registered: Sep 2004
Posts: 47 (0.01 al dì)
Location: Milano
Corso: Informatica (F49)
Anno: c++
Time Online: 2 Days, 15:14:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

-- -- determinare il cf dei macchinisti che percorrono il maggior numero di linee diverse
select mx.cf
from (select num_lin_div.cf, count(*) as linee_div
from (select cf, nome_linea, count(*)
from percorrenza as p1
where exists (select *
from percorrenza as p2
where p1.cf=p2.cf and p1.nome_linea<>p2.nome_linea
)
group by cf, nome_linea
) as num_lin_div
group by num_lin_div.cf
) as mx
where mx.linee_div >= ALL (select max(mx.linee_div)
from (select num_lin_div.cf, count(*) as linee_div
from (select cf, nome_linea, count(*)
from percorrenza as p1
where exists (select *
from percorrenza as p2
where p1.cf=p2.cf and p1.nome_linea<>p2.nome_linea
)
group by cf, nome_linea
) as num_lin_div
group by num_lin_div.cf
) as mx
)
;

Attachment: ferrovia.zip
This has been downloaded 1 time(s).

23-02-2007 10:50
Click Here to See the Profile for mostrielo Click Here to See the Blog of mostrielo Click here to Send mostrielo a Private Message Find more posts by mostrielo Add mostrielo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
zonker
.illuminato.

User info:
Registered: Mar 2003
Posts: 200 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 2 Days, 6:24:53 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Scusa se mi riposto...ma
select a.cf from
(select cf, nome_linea, count(*) as conteggio from percorrenza group by cf, nome_linea) a
where a.conteggio >= all (select count(*) from percorrenza group by cf, nome_linea);
è troppo semplice per piacerti?

23-02-2007 12:25
Click Here to See the Profile for zonker Click here to Send zonker a Private Message Find more posts by zonker Add zonker to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mostrielo
boolean

User info:
Registered: Sep 2004
Posts: 47 (0.01 al dì)
Location: Milano
Corso: Informatica (F49)
Anno: c++
Time Online: 2 Days, 15:14:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

I macchinisti devono percorrere il maggior numero di linee DIVERSE.

Attachment: ferrovia.zip
This has been downloaded 0 time(s).

23-02-2007 13:20
Click Here to See the Profile for mostrielo Click Here to See the Blog of mostrielo Click here to Send mostrielo a Private Message Find more posts by mostrielo Add mostrielo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
zonker
.illuminato.

User info:
Registered: Mar 2003
Posts: 200 (0.02 al dì)
Location:
Corso:
Anno:
Time Online: 2 Days, 6:24:53 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Hai ragione.
Cambio:
select cf from
(
select cf, count(*) as conteggio from
(select distinct cf, nome_linea from percorrenza) a group by cf
) b
where conteggio >= ALL (
select count(*) as conteggio from
(select distinct cf, nome_linea from percorrenza) c group by cf
);
Che te ne pare?

23-02-2007 13:33
Click Here to See the Profile for zonker Click here to Send zonker a Private Message Find more posts by zonker Add zonker to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mostrielo
boolean

User info:
Registered: Sep 2004
Posts: 47 (0.01 al dì)
Location: Milano
Corso: Informatica (F49)
Anno: c++
Time Online: 2 Days, 15:14:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Ok, va bene!

23-02-2007 14:06
Click Here to See the Profile for mostrielo Click Here to See the Blog of mostrielo Click here to Send mostrielo a Private Message Find more posts by mostrielo Add mostrielo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mark
.grande:maestro.

User info:
Registered: Oct 2003
Posts: 783 (0.10 al dì)
Location:
Corso: F49
Anno: finito!
Time Online: 8 Days, 18:34:33 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

CLIENTE (Nr.telefono, Nome, Indirizzo)
ORDINE (Nr.telefono, Codice-Pizza, Codice-Operatore, Data, Costo)
PIZZA (Codice-Pizza, Nome, Prezzo)

Si richiede di formulare in SQL quanto segue:
• determinare per ogni operatore e ogni pizza il costo totale degli ordini effettuati;


SELECT codicepizza, sum(costo) FROM ORDINE GROUP BY codicepizza;

e con questa query estraggo il costo totale per ogni tipo di pizza venduta ma, come diamine ci inserisco l'operatore ?
La query è anche sbagliata perchè nella somma non tiene conto di operatori differenti :cry:

__________________
Non ti perdere di coraggio se ti tocca lavorare molto e raccogliere poco.....

25-02-2007 10:58
Click Here to See the Profile for mark Click here to Send mark a Private Message Find more posts by mark Add mark to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mostrielo
boolean

User info:
Registered: Sep 2004
Posts: 47 (0.01 al dì)
Location: Milano
Corso: Informatica (F49)
Anno: c++
Time Online: 2 Days, 15:14:46 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

può essere cosi?

SELECT codice_operatore, ordine.codice_pizza, sum(costo) as spesa_totale
FROM ordine, pizza
WHERE ordine.codice_pizza=pizza.codice_pizza
group by codice_operatore, ordine.codice_pizza;

26-02-2007 13:16
Click Here to See the Profile for mostrielo Click Here to See the Blog of mostrielo Click here to Send mostrielo a Private Message Find more posts by mostrielo Add mostrielo to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
mark
.grande:maestro.

User info:
Registered: Oct 2003
Posts: 783 (0.10 al dì)
Location:
Corso: F49
Anno: finito!
Time Online: 8 Days, 18:34:33 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Originally posted by mostrielo
può essere cosi?

SELECT codice_operatore, ordine.codice_pizza, sum(costo) as spesa_totale
FROM ordine, pizza
WHERE ordine.codice_pizza=pizza.codice_pizza
group by codice_operatore, ordine.codice_pizza;



si, è perfetto grazie

__________________
Non ti perdere di coraggio se ti tocca lavorare molto e raccogliere poco.....

26-02-2007 16:43
Click Here to See the Profile for mark Click here to Send mark a Private Message Find more posts by mark Add mark to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 06:14.    Post New Thread    Post A Reply
Pages (2): « 1 [2]   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.074 seconds (64.51% PHP - 35.49% MySQL) con 23 query.