top of page

MySQL, Oracle Database Assignment Help | SQL Quires - Practice Set

Database:

For this project, you will be working with the sample ScrubsHospital database.


Tables:

The ScrubsHospital database has the following tables-

physician:

  • employeeid – this is a unique ID of a physician

  • name – this is the name of a physician

  • position – this is the designation of a physician

  • ssn – this is a security number of a physician

department:

  • departmentid – this is a unique ID for a department

  • name – this is the name of a department

  • head – this is the ID of the physician who is the head of a department, referencing to the column employeeid of the table physician

affiliated_with:

  • physician – this is the ID of the physicians which is referencing to the column employeeid of the physician table

  • department – this is the ID the department which is referencing to the column departmentid of the department table

  • primaryaffiliation – this is a logical column which indicate that whether the physicians are yet to be affiliated or not

  • Note: The combination of physician, department will come once in that table.

MedProcedures:

  • code – this is the unique ID of a medical procedure

  • name – the name of the medical procedure

  • cost – the cost for the procedure


trained_in:

  • physician – this is ID of the physicians which is referencing to the column employeeid of the physician table

  • treatment – this is the ID of the medical procedure which is referencing to the column code of the procedure table

  • certificationdate – this is the starting date of certification

  • certificationexpires – this is the expiry date of certification

  • Note: The combination of physician and treatement will come once in that table.

patient:

  • ssn – this is a unique ID for each patient

  • name – this is the name of the patient

  • address – this is the address of the patient

  • phone –this is the phone number of the patient

  • insuranceid– this is the insurance id of the patient

  • pcp –this is the ID of the physician who primarily checked up the patient which is referencing to the column employeeid of the physician table

nurse:

  • employeeid – this is the unique ID for a nurse

  • name –name of the nurses

  • position– the designation of the nurses

  • registered– this is a logical column which indicate that whether the nurses are registered for nursing or not

  • ssn –this is the security number of a nurse

appointment:

  • appointmentid– this is the unique ID for an appointment

  • patient– this is the ID of each patient which is referencing to the ssn column of patient table

  • prepnurse– the ID of the nurse who may attend the patient with the physician, which is referencing to the column employeeid of the nurse table

  • physician– this is the ID the physicians which is referencing to the employeeid column of the physician table

  • start_dt_time – this is the schedule date and approximate time to meet the physician

  • end_dt_time– this is the schedule date and approximate time to end the meeting

  • examinationroom– this the room where to meet a patient to the physician

medication:

  • code –this is the unique ID for a medicine

  • name –this is the name of the medicine

  • brand –this is the brand of the medicine

  • description– this is the description of the medicine

prescribes:

  • physician – this is the ID of the physician referencing to the employeeid column of the physician table

  • patient – this is the ID of the patient which is referencing to the ssn column of the patient table

  • medication – the ID of the medicine which is referencing to the code of the medication table

  • date – the date and time of the prescribed medication

  • appointment – the prescription made by the physician to a patient who may taken an appointment which is referencing to column appointmentid of appointment table

  • dose – the dose prescribed by the physician

  • Note: The combination of physician, patient, medication, date will come once in that table.

block:

  • blockfloor – ID of the floor

  • blockcode - ID of the block

  • Note: The combination of blockfloor, blockcode will come once in that table.

room:

  • roomnumber – this is the unique ID of a room

  • roomtype – this is type of room

  • blockfloor - this is the floor ID where the room in

  • blockcode – this is the ID of the block where the room in

  • unavailable – this is the logical column which indicate that whether the room is available or not

  • Note: The of blockfloor, blockcode columns are refercing to the combination of blockfloor and blockcode columns of the table block.

on_call:

  • nurse – this is ID of the nurse which is referencing to the employeeid column of the table nurse

  • blockfloor - this is the ID of the floor

  • blockcode – this is the ID of block

  • oncallstart - the starting date and time of on call duration

  • oncallend – the ending date and time of on call duration

  • Note: The combination of nurse, blockfloor, blockcode, oncallstart, oncallend will come once in that table and the combination of blockfloor, blockcode columns are refercing to the combination of blockfloor and blockcode columns of the table block .

stay:

  • stayid - this is unique ID for the admission

  • patient – this is the ID of the patient which is referencing the ssn column of patient table

  • room - this is the ID of the room where the patient admitted and which is referencing to the roomnumber column of the room table

  • start_time – this is the time when a patient admitted

  • end_time – this is the time how long a patient is staying

undergoes:

  • patient - this is ID of the patient which is referencing to the ssn column of the patient table

  • procedure – this is ID of the procedure and referencing to the code column of the procedure table

  • stay - this is the ID admission of a patient, which is referencing to the stayid column of the stay table

  • date – this is the date when a patient undergoes for a medical procedure

  • physician – this is the ID of a physician which is referencing to the column employeeid of the table physician

  • assistingnurse – this is the ID of a nurse who will assists the physician, referencing to the column employeeid of the table nurse

  • Note: The combination ofpatient, procedure, stay, date will come once in that table.


Entity Relationship (ER) Diagram



Questions


1. List the details of all nurses. In your output, generate an additional column called “Comment” and populate it with the text “Send registration reminder” if the nurse is not registered.


2. List all the departments and their head’s names along with the position of the head.


3. List the names of all patients and the number of appointments they have made where the examination room was “A”.


4. List all the unique patient names who got an appointment in room “B”.


5. List the names of all physicians who are trained in a particular medical procedure along with the name of the procedure. Also list their certification expiration date. You should have the following columns in your output- Physician name, Med Procedure Name, Certificate expiration.


6. List all the physicians with department who are not affiliated. Your output should contain columns with the names – Physician name, Department Name, Physician Position.


7. List the names of patients and their PCP only if their PCP is trained in a medical procedure.


8. List the names of patients and the number of physicians they have taken appointments with only if the number of physicians is greater than 1.


9. List all the patients along with their physician names, nurse names and room numbers when the patient has an appointment anytime between 4/21/2019 and 4/24/2019.


10. List all the patient names and their medications for patients who did not make an appointment.


11. List the count of number of rooms that are unavailable on each block on each floor. Make sure to order the list by floor and block number. Your output should have the columns – “Floor”, “Block” and “# of unavailable rooms”


12. List the floor where there are minimum number of rooms unavailable. Your output should have the floor number, max number of rooms possible on the floor and the number of rooms unavailable.



If you need any help related to Databases, SQL Queries, MySQL Database, Oracle Database, etc. then you can send your request at realcode4you@gmail.com and get instant help with an affordable price.



bottom of page