Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago