Question: a ) ( 9 points ) Find the procedure type, procedure subcode, and price of the most expensive procedure ( s ) . sql b

a)(9 points) Find the procedure type, procedure subcode, and price of the most expensive procedure(s). sql
b)(11 points) For each type of procedure, find the number of its subtypes (=subcodes). Requirements:
- Report each procedure type and the number of subcodes it has.
- The calculated column (= the number of subcodes per procedure type) should be named nr_subcodes.
- Order the report in descending order of the number of subcodes per procedure.
c)(15 points) Report the owner id, their first and last name, and number of pets owned by each owner who has at least 2 different (see below) pets that received pet care services. Requirements:
- The calculated column (= the number of different pets owned by each customer) should be named nr_of_pets.
- Order the report in descending order of the number of pets per owner.
- For each pet owner, you should count how many different pets they have; if someone used the vet services for a pet more than once, that pet should only be counted once.
d)(10 points) Report the procedure_type and procedure_subcode of all procedures that have never been used. In the template below, you must use a correlated subquery in the highlighted portion. Hint: The subquery will find, for each procedure (= row) in the outer query, data about the history of usage of that procedure; the subquery can be used in combination with comparison to a scalar (=0), or in combination with the NOT EXISTS operator.
SELECT procedure_type, procedure_subcode
FROM procedure_details D
WHERE .....(correlated subquery)
e)(8 points) Increase by 10% the price of all procedures under $25 and by 5% the price of all procedures that cost $25 or more. You must use:
- a single UPDATE statement,
- with the CASE operator.
f)(9 points) Delete all procedure history records for the pets whose names start with the letter J. It is required that you use a subquery to find who are these pets.

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 Programming Questions!