 |
Mr.O |
dubbio sql |
27-06-2009 10:28 |
|
 |
Mr.O |
mister
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
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 |
|
|
|  |
 |
Ste.dv |
Se ricordo bene gli schemi delle relazioni Corso, ... |
27-06-2009 11:22 |
|
 |
Ste.dv |
.precettore.
Registered: Apr 2008
Posts: 86 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 23:04:59 [...]
Status: Offline
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 |
|
|
|  |
 |
Mr.O |
questo e' lo schema
... |
27-06-2009 11:31 |
|
 |
Mr.O |
mister
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
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 |
|
|
|  |
 |
Ste.dv |
Sì, confermo.
... |
27-06-2009 11:57 |
|
 |
Ste.dv |
.precettore.
Registered: Apr 2008
Posts: 86 (0.01 al dì)
Location:
Corso:
Anno:
Time Online: 23:04:59 [...]
Status: Offline
Edit | Report | IP: Logged |
Sì, confermo.
Il natural join realizza esattamente la stessa operazione.
|
27-06-2009 11:57 |
|
|
|  |
 |
All times are GMT. The time now is 23:45. |
|
|
 |
|
 |
|
|
|  |
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
|
|
|
|
|
|