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 ~ comunicazione digitale > dubbio sql
  Last Thread   Next Thread
Author
Thread    Expand all | Contract all    Post New Thread    Post A Reply
Collapse
Mr.O
mister

User info:
Registered: Oct 2004
Posts: 115 (0.02 al dì)
Location: Milano
Corso: Com Dig
Anno: 3++
Time Online: 3 Days, 9:40:49 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged
dubbio sql

qlc sa dirmi se questa interrogazione :

code:
select Docente, count(*) from Corso, Lezione, Periodo where Corso.CodC=Lezione.CodC and Lezione.CodP=Corso.CodP and (Giorno=’Lunedì’ or Giorno=’Martedì’) and Aula=’Alfa’ group by Docente having count (distinct Corso.CodC)=2;


la posso scrivere anche cosi' :

code:
select Docente, count(*) from Corso natural join Lezione natural join Periodo where (Giorno=’Lunedì’ or Giorno=’Martedì’) and Aula=’Alfa’ group by Docente having count (distinct Corso.CodC)=2;

27-06-2009 10:28
Click Here to See the Profile for Mr.O Click here to Send Mr.O a Private Message Find more posts by Mr.O Add Mr.O to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Ste.dv
.precettore.

User info:
Registered: Apr 2008
Posts: 86 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 23:04:59 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Se ricordo bene gli schemi delle relazioni Corso, Lezione e Periodo sì: è lo stesso.
In generale devi solo assicurarti che non vi siano attributi omonimi oltre ai riferimenti (in questo caso CodC e CodP) che legano le relazioni.

27-06-2009 11:22
Click Here to See the Profile for Ste.dv Click here to Send Ste.dv a Private Message Find more posts by Ste.dv Add Ste.dv to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Mr.O
mister

User info:
Registered: Oct 2004
Posts: 115 (0.02 al dì)
Location: Milano
Corso: Com Dig
Anno: 3++
Time Online: 3 Days, 9:40:49 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

questo e' lo schema

code:
Corso(CodC, Nomenn, Docentenn) Lezione(CodC fk->Corso.CodC, CodP fk->Periodo.CodP,Aulann,Edificionn) Periodo(CodP, Giornonn, OraInn)

27-06-2009 11:31
Click Here to See the Profile for Mr.O Click here to Send Mr.O a Private Message Find more posts by Mr.O Add Mr.O to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
Collapse
Ste.dv
.precettore.

User info:
Registered: Apr 2008
Posts: 86 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 23:04:59 [...]
Status: Offline

Post actions:

Edit | Report | IP: Logged

Sì, confermo.
Il natural join realizza esattamente la stessa operazione.

27-06-2009 11:57
Click Here to See the Profile for Ste.dv Click here to Send Ste.dv a Private Message Find more posts by Ste.dv Add Ste.dv to your buddy list Printer Friendly version Email this Article to a friend Reply w/Quote
All times are GMT. The time now is 23:45.    Post New Thread    Post A Reply
  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.055 seconds (54.13% PHP - 45.87% MySQL) con 26 query.