Question: Assume you have a statistical database about inpatient data with the following schema. The only legal queries are those involving COUNT, SUM, MIN, MAX and

Assume you have a statistical database about inpatient data with the following schema. The only legal queries are those involving COUNT, SUM, MIN, MAX and AVG.
Inpatient (PatientID, Fname, Lname, AdmitDate, HomeCounty, TotalCost)
Assume that there is only one inpatient who resides in Lackawanna County. Write a legal SQL query to compute the total cost of that inpatient.
Assume that there are exactly two inpatients who reside in Pike County. Write a legal query that would allow you to deduce the total cost of each of the two inpatients.
Below is a legal query and its returned result:
Query:
SELECT MIN(TotalCost), MAX(TotalCost), SUM(TotalCost), COUNT(*)
FROM Inpatient
WHERE HomeCounty=Wayne;
Result:
| Min | max | sum | Count |
| $800.00 | $1200.00 | $2900.00 | 3 |
Based on the returned result, can you infer the total cost for each inpatient from Wayne County? Explain your answer.
InsuranceComp ID Name PhoneNum Patient ID Fname Lname BirthYear Sex Zipcode PhoneNum OfficeVisit PatID DocID Month Day Year Outcome Charge HasPolicyWith Pat ID InsCompId StartDate Took PatID DocID Physician ID Fname Lname OfficeNum Specialty Result LabTest ID Name Charge Description
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
