Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 decade ago

oracle database anyone?

Show all the patients that have visited the clinic more than 10 times. Show at least the surname and given name of the patient.

APPOINTMENT

Name Null? Type

----------------------------------------- -------- ----------------------------

APPOINTMENTID NOT NULL NUMBER(38)

DATEOFAPPOINTMENT DATE

TIMEOFAPPOINTMENT DATE

DOCTORID NUMBER(38)

PATIENTID NUMBER(38)

DONE CHAR(1)

CONSULTATION_ROOMNO NUMBER(38)

PATIENT

Name Null? Type

----------------------------------------- -------- ----------------------------

PATIENTID NOT NULL NUMBER(38)

SURNAME VARCHAR2(40)

GIVEN VARCHAR2(40)

DOB DATE

SEX CHAR(1)

PHONEHOME VARCHAR2(20)

PHONEWORK VARCHAR2(20)

PHONEFAX VARCHAR2(20)

ADDRESS VARCHAR2(40)

SUBURB VARCHAR2(40)

STATE VARCHAR2(40)

POSTCODE VARCHAR2(

1 Answer

Relevance
  • 1 decade ago
    Favorite Answer

    select count(a.appointmentid) as visits,

    b.surname as surname,

    b.given as given

    from patient b,

    appointment a

    where a.patientid = b.patientid

    group by b.surname, b.given

    having count(a.appointmentid) > 10

Still have questions? Get your answers by asking now.