Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help!!! on SqlPlus query
SELECT T1.name_h ,
T2.name_m , count(T4.code_patient) FROM Hospital T1 , Medecin T2 , Hos_med T3 , Med_pat_hos T4 WHERE T4.code_h (+) = T3.code_h and T4.code_m (+) = T3.code_m and T1.code_h = T3.code_h and T2.code_m = T3.code_m
At first, I didn't know why you had the Hos_med table.... but it makes sense that a doctor works in an hospital with no patient in this hospital...
With that query, you'll have these relations (hospital,medecin) with no patient...
PQTN.
Hongbo Zhang wrote in message <2DmP2.899$0C1.109214_at_carnaval.risq.qc.ca>...
>Hi,
>
>I am new on Oracle. I have 4 following tables:
>
>HOSPITAL:
>-------------------------
>CODE_H | NAME_H |
>--------------------------
>
>MEDECIN:
>--------------------------
>CODE_M | NAME_M |
>--------------------------
>
>HOS_MED:
>---------------------------
>CODE_H | CODE_M |
>--------------------------
>
>MED_PAT_HOS:
>-----------------------------------------------
>CODE_M | CODE_H | CODE_PATENT |
>----------------------------------------------
>
>Would you please help me to realize this query with Oracle Sqlplus: for
>every MEDECIN,
>find the name of hospital he works and count the nomber of patients he
>treats.
>
>Thanks
>
>Hongbo
>
>
Received on Fri Apr 09 1999 - 22:40:18 CDT
![]() |
![]() |