DATABASE QUERIES AND STORED PROCEDURE QUESTION GIVEN THE FOLLOWING TABLE Perform
ID: 3797706 • Letter: D
Question
DATABASE QUERIES AND STORED PROCEDURE QUESTION
GIVEN THE FOLLOWING TABLE
Perform the following queries
1)
Write a stored procedure to display the average fee that each veterinarian earned. It is expected that your stored procedure will work for any instances of the above scheme
2)
Write a stored procedure to display the sum of the fees that the veterinarian with vetName X earned at location (locName) Y.
X and Y are to be input parameters to the stored procedure
Both parts of this problem involve the following schema Veterinarians lieuns.Num Integer, vetName: String); Examine licenseNum: Integer, did: Integer, lid: Integer, fee: Real) Dogs (did: Integer, dogName: String); Location did: Integer, locName: String); Use the following instances: Veterinarians vetName icenseNum Alice 112 Mary Jim Dogs dogName did Spot 324 Fido 582 Tiger 73 Examine 324 Dool II003 Ill 324 Door 30 S82 0002 3224 I 582 Location: Do Name Cloud 1002 Minneapolis D003 DuluthExplanation / Answer
SELECT vetName, AVG(fee) AS AverageFee from Veterinarians
LEFT JOIN Examine ON Veterinarians.licenceNum=Examine.licenceNum
where licenceNum=@licenseNumber
END
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.