Question: The Database Schema: create database JPMmedical;use JPMmedical;create table surgery (surgeryID varchar(4) primary key,surgeryDate varchar(10),surgeryDesc varchar(10),surgeryCost integer,patientID varchar(4),doctorID varchar(4) );create table doctor (doctorID varchar(4) primary key,doctorFN

The Database Schema:

create database JPMmedical;use JPMmedical;create table surgery (surgeryID varchar(4) primary key,surgeryDate varchar(10),surgeryDesc varchar(10),surgeryCost integer,patientID varchar(4),doctorID varchar(4) );create table doctor (doctorID varchar(4) primary key,doctorFN varchar(10),doctorLN varchar(10),doctorPhone varchar(8),doctorEmail varchar(20) );create table patient (patientID varchar(4) primary key,patientFN varchar(10),patientLN varchar(10),patientRoom varchar(5),patientPhone varchar(8),doctorID varchar(4) );insert into surgery values("S001","12/09/2011","Heart",96000,"P100","D040"),("S999","04/07/2012","Hand",5000,"P100","D040"),("S303","10/10/2010","Back",14000,"P099","D300"),("S201","11/11/2011","Heart",87000,"P200","D300"),("S200","01/01/2001","Back",22000,"P300","D100"),("S105","02/02/2002","Hand",3000,"P205","D200"),("S210","03/03/2011","Shoulder",8000,"P205","D200"),("S111","10/12/2011","Back",22000,"P400","D100");insert into doctor values("D200","Sue","Pluto","555-1234","sue@pluto.com"),("D100","Aaron","Saturn","555-1111","aaron@saturn.com"),("D300","Jim","Mercury","555-2222","jim@mercury.com"),("D040","Alice","Earth","555-5555","alice@earth.com");insert into patient values("P100","Mary","Walnut","Ward1","555-8888","D040"),("P099","Joe","Pecan","Ward3","555-7777","D300"),("P200","Ali","Cashew","Ward4","555-3333","D300"),("P300","Frank","Hazel","Ward5","555-5050","D100"),("P205","Debra","Almond","Ward1","555-8888","D200"),("P400","George","Peanut","Ward4","555-3333","D100");

I need help Displaying the table:

heres what I have so far, but it won't work

Select patientLN 'Patient', surgeryDate 'Date', SurgeryDesc 'Surgery', DoctorLN 'Doctor' from doctor, patient, surgery /* where patientID = surgery.patientID and doctorID = surgery.doctorID */ Order by surgeryDate;

Question:

What is the last name of the patient (alias Patient), date of surgery (alias Date), surgery description (alias Surgery) and doctor last name (alias Doctor) for surgerys that cost more than $10,000?

This is not an intersection join, it is two inner joins (patient-surgery and doctor-surgery). So, it will have multiple AND statements, 2 for the joins and 1 more for the cost.

Order by surgery date.

Patient

Date

Surgery

Doctor

Hazel

01/01/2001

Back

Saturn

Pecan

10/10/2010

Back

Mercury

Peanut

10/12/2011

Back

Saturn

Cashew

11/11/2011

Heart

Mercury

Walnut

12/09/2011

Heart

Earth

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related General Management Questions!