TASK 1 :
Draw an Entity-Relationship (ER) diagram for a General Hospital’s database using the following information.
1. The General Hospital consists of a number of specialized WARDS (such as Maternity, Pediatrics, Oncology, etc). Each ward has a name, code and hosts a number of patients.
2. On admission, the personal details of every PATIENT are recorded. These include ID, name, address, gender, birth date and illness. We also need to store the information of the tests undertaken by a patient and the results of a prescribed treatment. A number of tests may be conducted for each patient. Each patient is assigned to one leading consultant but may be examined by another doctor, if required.
3. Each patient also has a ATTENDANT. This person is a family member or friend who looks after the patient and takes responsibility for them.
4. DOCTORS have their own IDs and a specialization in some branch of medicine and there are three types of doctors – consultants, specialists and interns. Each intern is supervised by a specialist doctor. One doctor can act as a consultant for a several patients. Their patients can be admitted in a number of wards.
Clearly show primary key attributes.
1. Draw a data model - having at least four attributes - of an entity of your choice.
2. Using SQL in Oracle 10g,
a. Create a table for this entity and insert at least four rows of data.
b. Conduct Project and Restrict in a single query.
c. List rows in some given order.
d. Modify a row based on a given condition.
For each SQL task, you must show both the query and the output.