North Alabama Database Management Systems SQL Statement Assignment
North Alabama Database Management Systems SQL Statement Assignment
Statements for each tasks. Attached is the text to create the database.
- For each patient, display his or her last name, first name, and the name of his or her doctor.
- For each pediatrics patient, display his or her ID and his or her doctor’s ID and name.
- For each doctor, display the name and the name of the doctor’s supervisor in alphabetic order of supervisor’s name. Include column aliases for clarity. Note: Check for accuracy.
- For each doctor in one of the two areas entered by the user, show the doctor’s name and annual salary (including bonus), and his or her supervisor’s name and annual salary. Note: Try Pediatrics and Orthopedics as the two areas.
- For patients whose last name matches the name entered by the user, display their first name, phone number, and doctor’s name. Note: Try Davis.
- Display the number of doctors that currently have patients. Note: Check for accuracy.
- Show the total annual bonus earned by doctors hired in the year entered by the user. Note: Try 1998.
- Display the lowest and highest charge per appointment. Note: Use MAX and MIN functions.
- Display the number of patients currently assigned to each doctor.
- For each area of specialization, display the number of patients from each town represented.
- For all areas with at least two doctors, display the average charge per appointment, rounded to the nearest dollar and appropriately formatted.
- For all doctors except numbers 432 and 509, display the average balance owned by their patients in ascending order. Ignore groups with a total of less than $100 owned.
- Display the names of doctors in Dr. Harrison’s area. Note: The piece of information that needs to be determined first is Dr. Harrison’s area).
- Display the names and salaries of doctors who earn more than the average salary.
- Display the names of doctors who are also supervisors.
- Display the names and monthly salaries of doctors who earn more than all of the doctors in pediatrics. Note: Use the ALL operator.
- Display the names and charges per appointment for doctors that charge more per appointment than any one of the doctors in neurology. Note: Use the ANY operator.
- Display the names of doctors that have the same area and charge per appointment as Dr. Lewis does. Note: Dr. Lewis should not be in your output.
- Show the IDs of the patients who live in the same town as patient number 168. Note: Check for accuracy.
- Susan Porter has canceled her next appointment. In order to try to fill her spot, display the names and next appointment dates of patients who have appointments with her doctor on a later date.